This seems a really simple question to answer, but being fairly new to JS, I have no idea how to do it:
I'd like to insert a string which contains JS commands set by one function into another function. Below is sample code which hopefully explains what I want to do:
Probably alarmingly simple, but can't find any example code.
Thanks
I'd like to insert a string which contains JS commands set by one function into another function. Below is sample code which hopefully explains what I want to do:
Code:
func1 () {
---blah---
if (t == 1) {
test = "
if (j1=="right" && i1<24) {
i1 = parseInt(i1)+1;
} else {
i1 = parseInt(j1); }
";
---blah---
OR SET test USING OTHER CONDITIONS
---blah---
}
funcA() {
---blah---
INSERT test HERE
---blah---
}
Thanks
Comment