# How do you use the modulus to calculate the reminder days?

#1

Step 1: Let's
say it's a full moon tonight, and we want to know what the moon will
look like one year from today. We know from the moon phase image to the
right that the moon circles the Earth every 27 days, so let's start by
dividing 365 by 27.
Remember to put your calculations inside console.log to print them to the screen.

code:

console.log('13.52')

"Do the same calculation as Step 1, but this time replace the division operator with a modulus: %." thats the hint I was given but it didn't work.

``console.log("365%27")``

#2

@cssrockstar02579, the " " quotation marks is for string type value/data.
Example: when you want to print a string, such as `console.log("What is your name?") ;`

If you want to use console.log to print a math operation or number type value/data, it should be without " "

Anyway, can you post your full code answer? I suspect you got the first one wrong as well.

#3

Yes, that is correct. whenever you are using numbers you should do the expression with no quotation marks. the quotation marks are ONLY for strings.

keep in mind that numbers can be strings, but strings cannot be numbers.

so:
20 is not the same as "20". so whenever you are creating variables that is the time to decide whether or not that number needs to be a actual number or a string that happens to be a number. if you are going to do any kind of math expression then it has to be an actual number.

so basically if the variable is going to be used to quantify something, then it needs to be a number. if its anything else, then its ok to use as a string.

#4

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