JavaScript help needed please thanks


#1

Tutorial is asking this:

Use console.log and modulo three times to print the remainder of the following equations:

a. 14 / 3
b. 99 / 8
c. 11 / 3

And I have come up with this:

// Below is an example of printing the remainder of 18/4 using modulo:
// console.log(18 % 4);
console.log(" 14 % 3 === 2 ")
console.log(" 99 % 8 === 3 ")
console.log (" 11 % 3 === 2 ")

but it's wrong.

Could you take a look at it and tell me what is wrong?

Thank you,

Jina


#2

if we want to calculate the remainder of 18/4 we do:

console.log(18 % 4);

as the example demonstrates. Now you need to do the same for 14/3, 99/8 and 11/3


#3

your solution..

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

Problems in your solution ---
1. By putting " " around them you're making them string.
2.Even you did something like this..it's also wrong..
console.log(14 % 3 === 2 )
You did not asked to compare 14 % 3 with 2 but simply asked to find the remainder ..
i.e 14%3

Modulo operator:
% gives remainder!

It only asks to print remainder

like if I had to find remainder of 10 / 3 and print it
I'd do something like this...

console.log(10 % 3);


#4

Okay!

Got it!

Thanks alot!!

Jina


#5

Okay great!

solved!

Thanks so much!!

Jina


#6

Keep up the good work!~ :slight_smile: :thumbsup:


#7

Sure,

Thanks!

Jina

.........


#8

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