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

Dax Murray
Dax Murray
8,827 Points

Keeping getting "Bummer! The variable "GermanyGDP" was not defined."

I'm tying in var GermanyGDP = 3.4E12; into the file between the two <scripts? with viewer.js in them, and keep getting that GermanyGDP is not defined. I'm not sure what I'm doing wrong. Please assist.

index.html
<!DOCTYPE html>
<html lang="en">
  <head>
    <title> JavaScript Foundations: Creating Numbers</title>
    <link rel="stylesheet" href="core.css">
    <script>
      // exponential notation
      //    1E6 === 1000000
      // 1.23E6 === 1230000

      // octal number literals
      //  06 ===  6
      //  07 ===  7 
      // 010 ===  8
      // 011 ===  9
      // 012 === 10



    </script>
  </head>
  <body>
    <h1>JavaScript Foundations</h1>
    <h2>Creating Numbers: Part 2</h2>
    <script src="viewer.js">
      var GermanyGDP = 3.4E12;
    </script>
  </body>
</html>

4 Answers

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Nikki;

The script tag residing in the HTML head tags is where this particular script application is being written. The viewer.js tag is linking the viewer.js file which will process the data from the above JavaScript. If you click on the Preview button in the code challenge you can see the results of the variables being set in the challenge.

Hope it helps and welcome to Treehouse!

Ken

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Nikki;

Define your variable in the first script tags.

Ken

Dax Murray
Dax Murray
8,827 Points

Can I ask why that is the correct answer? To me, it seems like it would make sense to go in the viewer.js tag, as that tag contains JS. Thank you for the response!