ReferenceError shows up on console and yet it lets me move on to next lesson


#1


// Define quarter here.
var quarter = function (number) {
var val = number / 4
};
quarter("condition");

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



When this code is typed in, "ReferenceError: number is not defined" shows in console, and yet, it lets me go on to the next lesson. Please let me know what I'm doing wrong (eg what I should take out, should add, etc). I'm pretty lost and could use some help.


Replace this line with your code.


#2

In your quarter function the body should contain a return statement not a variable declaration,

no need to store it in a variable,

return number / 4

Also, Remove this line,

And put an integer in between the parentheses of the function call in your if statement,

any integer,

if ( quarter(10) //any you would like


#3

Wow, I just received the notification for your comment. I went back and fixed my (disasterous) code. Thank you so much!


#4

You're welcome. :smile:


#5

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