Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript JavaScript Foundations Numbers Creating Numbers: Part 2

Dan Neumann
PLUS
Dan Neumann
Courses Plus Student 10,318 Points

Javascript creating numbers

In the quiz I'm supposed to create a variable named GermanyGDP and assign it a value of 3.4 trillion. I put this code in between the script tags in the body:

var GermanyGDP = 3.4E12;

and it said that the variable was not defined. What am I doing wrong?

2 Answers

Once you write var GermanyGDP = 3.4E12;
the GermanyGDP gets defined to be 3400000000000

I think you do not have any mistake

Dan Neumann
PLUS
Dan Neumann
Courses Plus Student 10,318 Points

Thanks - I figured out what I was doing wrong. I put the answer in the body instead of the head. I put it in the head and it worked.

All you javascript code should be inside <script> ... </script> tag which should usually be at the end of the body. WHat do you mean head?