More on Control flow debugging


#1


var didgit = Math.floor(Math.random()*Math.random()+ 2)
var isEven = function(number) {
  // Your code goes here!
  if(didgit%2===0){
      return false;
  }else{
      return true;
  }
};

Still don't understand why this doesn't work.


#2

would you mind sending a link? and maybe the error message please?


#3

Your syntax looks fine so I think it might have something to do with the instructions


#4

https://www.codecademy.com/courses/javascript-beginner-en-qDwp0/0/1?curriculum_id=506324b3a7dffd00020bf661


#5

you did a lot of extra work here. all you needed to do was make it any number you want
my version of this was var number = 36.
that seems to be the only difference between mine and your code


#6

your code might work if you change the variable name to number instead of didgit


#7

or change the parameter to didgit instead of number


#8

It's now giving me this:

Oops, try again. Looks like your function returns false when number = 3. Check whether your code inside the if/else statement correctly returns true if the number it receives is odd.


#9

ok can you send me the current code?


#10

var didgit = 36
var isEven = function(number) {
if(didgit%2===0){
return true;
}else{
return false;
}
};


#11

change number to didgit


#12

Thank you so much! Big help right there.


#13

no problem man, good luck on the rest of the course


#14

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