Javascript Function not defined error in code -
i new javascript , don't understand why getting error piece of code. please me understand syntax got wrong.
var iseven = function(number){ if(number % 2 = 0){ return true; } else { return false; }; }; iseven(5);
change
if(number % 2 = 0)
to
if(number % 2 === 0)
because want test if modulo 2 of number has no remainder. wrote illegal assignment operation.
Comments
Post a Comment