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

Help

A variable named "boxWidth" already exists with a value of "640px". Create a new variable named "numWidth" and use the "

 <script>
      var boxWidth = "640px";
      var boxHeight = "480px";
      var numWidth = parseInt("640px");
    </script>

What is wrong with my code?

3 Answers

Use the variable boxWidth instead of the string literal of its value.

Also, you should always specify the radix parameter to avoid confusion and weird behaviour, like this:

var parsedString = parseint(someString, 10);

Finally, Tyson, I encourage you to use more descriptive discussion titles than just "Help!" as you've been doing so far. You'll find that people are more likely to answer such topics and they're also easier to discover by users needing help on the same task.

Good call about the radix, I left it out.

Nothing is "wrong" with it, the challenge is asking you to make use of the variable that you already set to 640px though instead of rewriting it.

Thanks guys