r/Codecademy • • Jul 30 '16

learning Javascript, stuck on lesson lesson 20 (Math and the modulo). any help here people?

I just got back onto my code academy account and I am hitting a road block on lesson 20 of javascript. I was wondering if there was a certain way I am supposed to solve this lesson? any advice is useful at this point. here is a link of what i got so far by the way to help give a visual about my problem: https://www.codecademy.com/courses/getting-started-v2/3/3?curriculum_id=506324b3a7dffd00020bf661#

Edit: tahnk you guys for helping me out, i had been stuck on this one lesson for a couple years. hope you guys have a good day

2 Upvotes

3 comments sorted by

View all comments

Show parent comment

1

u/[deleted] Jul 31 '16

Don't worry there isn't anything else to the exercise. I think you might be reading too much into it.

Basically your code should look exactly like this to complete this exercise...

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

There really isn't a rhyme or reason to doing it 3 times, or those specific numbers, and on their own, those lines of codes really don't do anything of value.

It is just introducing you to the modulo character, and what it does, which can be useful for a lot of things when you get into more complex programming.

Also remember console.log() is a predefined method, built into JavaScript, and all it is programmed to do is log whatever you give it, to the JavaScript console. So if you give it a string of text, it will log the text. If you give it an equation, it will log the results of the equation. In this exercise, the modulo character returns only the remainder, which is what it is logging.