Lesson 20


#1

Ok so i'm trying to complete this but it keeps saying the second console.log() isn't quite right.

Heres my code:

14 % 3
99 % 8
11 % 3
console.log("2")
console.log("2")
console.log("2")

Help ASAP


#2

Help will always arrive ASAP, what other options are there?

You know that JavaScript can do math for you - yes?
Why bother to hard code your console.logs with "2" each time?
Why not have JavaScript do the math AND log it? You can look back at exercise 12 if you need a reminder of how that works.


#4

I am also struggling with this. Mine says 'Did you console.log() the result of 14 % 3 ?' and what I have written out is
// console.log(18 % 4);
// console.log(14 % 3);
// console.log(99 % 8);
// console.log(11 % 3);


#5

@flat10nan

remove the // before the lines,

thats making them into comments

console.log(18 % 4);


#6
If you are doing it like "console.log("2");" you don't even need the "14 % 3"...

The point here is to use console.log to print the remainder of each one of those! So you do it like this:

console.log(14 % 3);
console.log(99 % 8);
console.log(11 % 3);

Easy as that! And by the way... The remainder of 99 % 8 is 3... Not 2! Also please but please! I see this everywhere! Don't forget the semicolon ( ; ) in the end of your commands please!

#7

Because on #2 you have to put the remainder which is 3 so it would be ("3")


#8

But, don't do that. You are learning to program here so make the computer do it.


#9

Make sure you are using "%" and not "$". I just spent 10 minutes figuring out why this wasn't right


#10

The remainder of 99 % 8 is 3 not 2.:sunglasses:


#11

Thank you! This helped me out a lot!