Quarter function doesn't return correct value


#1

Hi There, I've got the following code but it puts me into a loop expecting me to enter -100, then -96, then -92 etc etc. If I don't put what's expected, it says "Oops, try again. Hmm, it looks like your quarter function doesn't return -25 for -100."

// Define quarter here.
var quarter = function (number) {
number = prompt("Please enter a number");
return number / 4;
};

if (quarter() % 3 === 0 ) {
console.log("The statement is true");
} else {
console.log("The statement is false");
};

Is it because I'm prompting the user for the value rather than passing a specific value to the function?

Thanks in advance for your help :slight_smile:


I get stuck in lesson 6 of introduction of function js...please send the code
#2

First, "number" is just a substitute for the value you put in, which means you shouldn't try to define it. Also, the if statement probably needs a variable in the quarter() function.


#3

Yep, awesome, thanks so much for your help!