javascript - Adding text inside of if() from a function -
I am having a problem, I have created this function:
function array ( Number) {Var textToReturn = ""; (Var i = 1; i & lt; = number; i ++) {textToReturn + = "array [i" + (+ (i-1)) + "] == artex [" + (i-1 ) + "]"; If (i! = Number) {textToReturn = textToReturn + "& amp;" ;; }} Return text again; };
And I am using IF condition inside this function:
for (var i = 0; i & lt; array.lambi ; I ++) {if (ArrayCounter (arrayText.length)} { but it does not work, and if I manually add the result of the array (IF) This will work inside, what should I do, it works?
but it does not work
this job Does and returns the desired text.
I am using this function in the IF condition
... but the value of a high-position boolean is expected, a string No! You were originally executing
if ("array [0] == array text [0] and array [1] == array text [1]") {
but need
if (array [0] == array text [0] and array [1] == array text [1]) {
< What should I do to make this work?
You type the eval ()
but do not do that. eval
is bad behavior, it should not be used for it.
Instead, create a function array
that you pass two arrays and the boolean that returns!
Comments
Post a Comment