Code Hs is it even

ysiyez16

Commendable
Jan 12, 2017
2
0
1,510
alue is even or odd. The isEven function should not print anything out or return a number. It should only take in a number and return a boolean.

For example, if you made a call like

var isEvenNumber = isEven(4);
isEvenNumber should have the value true.

Once you’ve written this function, write a program that asks the user for integers and prints whether the number they entered is even or odd using your isEven function. You should let the user keep entering numbers until they enter the SENTINEL.

Here is a sample run of the program:

Enter a number: 5
Odd
Enter a number 42
Even
Enter a number: -6
Even
Enter a number: 0
Done!

this is what code hs wants and this is what I did
function start(){
isEven(0);
}

function isEven(x){
var even = x % 2 == 0;

var odd = x % 2 == 1;

if(x = even){
var result = println("Even. ");
return result;
}
if(x = odd){
var reeult = println("Odd. ");
return reeult;
}
}

and code hs says that it is incorrect. I'm working on it for two weeks and I couldn't finish it. Someone please help !
 
Solution
Where the code that ask for user enter a number?

and your isEven is not returning true or false

Why are you comparing x with even or odd?