Lesson 8: Not understanding what I am missing


#1


Not understanding what I am missing. Did a little research (here at codeacadamy) but not seeing what my disconnect is.

It is my understanding that I:
-first define the function quarter
-return the number (which is divided by 4) .
-At the very end when I define the var for quarter (it should divide by four
then the "returned" value should replace quarter in the second set
-the modulo (which is 3) should take the 12(now 3) and make it 0

the output should be false (0 is false and 1 is true if I am understanding correctly). I do not want the answer but maybe a kick in the butt towards the right direction.


https://www.codecademy.com/courses/javascript-beginner-en-6LzGd/1/3?curriculum_id=506324b3a7dffd00020bf661#


SyntaxError: Illegal return statement


/ Define quarter here.
var quarter = funtion (number)
{
    return number/4;
};
    




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

quarter(12)


#2

inside your if condition:

(quarter) % 3 === 0 )

you should call quarter. Not at the very end. Also take a good look at how many parentheses you have


#3

Good catch on closing my brackets properly. I adjusted my code there and added the value inside the if params, but that does not resolve the syntax error for the illegal return statement. added some commenting where I made changes to see where my thinking is off at,

// Define quarter here.
var quarter = funtion (number)
{
//SyntaxError: Illegal return statement somewhere here
return number/4;
}
//tried adding a semi above and removing
//defined quarter inside if statement and closed braces
if (quarter(12) % 3 === 0 ) {
console.log("The statement is true");
}
else {
console.log("The statement is false");
};

link just in cases it changes when i change the code:
changed code


#4

you are right about this, but the problem is in the line above:

var quarter = funtion (number)

you misspelled function, so there is no function, so return is illegal


#6

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