Why does this code pass and how can I properly use %modelo instead?


my code surprisingly passes and I did not expect it to. How can I properly use %modelo instead?

var isEven=function(number) {
else if (isEven=1){


If you wanted to use the modulo, you would want to use something like

As far as why the code passes, I don't know. It was probably just a slip in the system. You're bound to find them here and there.


Did you get the correct answer?
Here is my take on it, I don't claim that is true or correct, just an observation.

I think your conditional works because isEven = (equals) 2, which then it is assigned to be true (isEven=true) and then the same for the else if condition.

I hope this post doesn't provide confusion. Feel free to correct me if I'm wrong.

As far as using the modulo, this worked for me:
var isEven = function(number) {

   if(number % 2 === 0){
       return true;
       return false;   

I read in another post to use "number" because that is the input needed to determine if it is divisble by 2.



I just let my initial code ride it out for that exercise... I'm gonna have to do some review after I get done with this section


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.