Undefined function error javascript -
maybe i'm being stupid, following simple function, told there reference error, iseven being undefined:
var iseven = function(number) { if (number%2=0) { return true; } else { return false; }; }; is there i've missed i'm doing wrong?
you're using assignment operation in if clause, , not equality check, you'll want change second line from
number % 2 = 0
to this:
(number % 2) == 0
the error mentioned happening because initial error detailing improper syntax, if ignore , still try call function tell never defined (because during definition there error).
Comments
Post a Comment