CodeHS JavaScript Help

luckyterrestrial

Estimable
Nov 22, 2015
5
0
4,510
0
Can someone help me with this problem?
Write a function called `isEven` that returns a boolean of whether or not a value 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!
 

luckyterrestrial

Estimable
Nov 22, 2015
5
0
4,510
0


var SENTINEL = 0;

function start(){
isEven(4);
}

function isEven(x){
var even = x % 2 == 0;
return even;
}
Have this so far
 

ASK THE COMMUNITY