How do you"print" the result?


#1

How do you"print" the result??


Need help with 'math and modulo'-lesson 20
#2

you would use   console.log(the variable, string, number, etc.);

In this scenario, it would be

console.log(the equation);


#3

yes but how to I get the answer to the equations. For example:

"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."

I can't get the answer to the equation without using my calculator application. But the program should just give me the answer, right? I try hitting the "enter" key and it just drops down to the next line.


#4

Hi @adventuresofalostgir,

From the information that you've given, it is hard to be sure, but:
- It sounds like you are in a text editor and haven't run the code yet.
- It also sounds like you are not working on the Math and Modulo lesson.

We can give better answers when we completely understand your questions.

Here is what I see in lesson 20 when I type in your example and then press the Submit button:


#5

@albionsrefuge

Ok, I guess your right. I am in the learning Javascript, very first lesson.

And I do enter the console equation and hit "run". It gives me a red box telling me:

"Did you divide 365 by 27 inside a console.log statement to print 13.518 to the console?"

I don't know how to get the 13.518 answer without a calculator sitting right next to me.

What do you think?

https://www.codecademy.com/courses/learn-javascript/lessons/introduction-to-javascript/exercises/math-operators-ii?action=lesson_resume


#6

Could you show us your console.log() statement please?


#7

I've tried it again in the lesson and now it seems to be working. I'm not sure what I am doing differently but I appreciate your help. Thank you! @albionsrefuge and @rhyscrypto


#8

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