Trouble on 8/13


#1

I'm having a syntax error on 8/13. This is my code.
// Define quarter here.
var quarter= function(number){
return number/4;
};
if (quarter("6")3===0){
console.log("The statement is true");
};else {
console.log("The statement is false");
};


#2

This part seems to be off. You need to remove the "" on 6 and you need to put some kind of operation (math) in between (6) and 3.

Also, that semicolon shouldn't be there.


#3

it still doesnt work unfortunately ;(


#4

It doesn't work because...

I stated that there needs to be some kind of math operation (specifically, a mondulo or however you spell it).


#5

oh @squirtleking i forgot :joy: sorry. it is modulo


#7

Hi I am having some trouble with the below! I dont understand where I am going worng! Can somone please advise!

// Define quarter here.
var number = function(quarter) {

  return nnumber/4;
}

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


#8

Hi squirtleking,

//Here is my code, it was approved however I don't think it's correct. Can you help me understand what I'm doing wrong here?

var quarter = function (number) {
quarter(9);
return number / 4;
}

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


#9

Hi.
u dont need this line

why do u need a recorsive call?


#10

Heey,

quarter(9) is not correct. It needs to be a number that can be divided by 4 and after that by 3. If you change the number 9 into(for example) 120 it might work.


#12

this should work guys
var quarter = function (number) {
quarter()
return number / 4;
}

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


#13

Hey, everyone!
I am here because I have a comment to make or I have a problem. The second reason is more accurate. So here's the problem:
I have been looking at what you have said and been trying all the possible possibilities but it doesn't work (me = :rage:) Right below you'll find my javascript and I hope you will spot my problem.

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

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

Thanks!


#14
var quarter = (number) {
    quarter() // this is a problem

because it calls the function inside the function so what happens:

quarter(6) calls the function -> enters function -> call function again quarter() ->
enters function -> call function again quarter() -> enters function -> call function again quarter() -> aso

Also 6/4 is 1.5 and 1.5%3 is not 0.


#15

Wow...ok here we go.

First, quarter isn't a function, unless you put function beside the parameter (number).

This isn't necessary.

Finally, quarter needs to be 12, because 12/4 = 3 & 3 % 3 === 0.


#16

It worked! (how could I have been so dumb!?)
Thanks @haxor789 & @squirtleking and the rest of the troop :wink:


#17

lol good job @squirtleking