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 trialBrian Schmitz
11,167 PointsParseInt Challenge
Can someone please help me parse the boxWidth string per the instructions in the objective. I created the numWidth variable and then tried to pull the numbers fro the boxWidth variable. I don;t recall the video going through how to parse another variable but rather only calling out a variable in the console to parse the number from a string within that variable.
var boxWidth = "640px"; var boxHeight = "480px"; var numWidth = parseInt("640", 10)
Also in the last objective for Math Objectives it asks to create a variable circumference and use the diameter variable and Pi. I have:
var Circumference = diameter * Pi
Do I need the actual Pi symbol? How do I create that on a Dell computer with Windows.
Help is appreciated. Thanks
5 Answers
Sreng Hong
15,083 PointsHi Brian <br />
About the parseInt function, i think you do it correct there but to make it through you need to write like this <br />
var numWidth = parseInt(boxWidth, 10);
Shawn Flanigan
Courses Plus Student 15,815 PointsThey want you to use the variables...not the values. So, try: var numWidth = parseInt(boxWidth, 10);
For your other question, use Math.PI to get the value of pi. So: var circumference = Math.PI * diameter;
Sreng Hong
15,083 PointsAbout the Pi, you need to include the word Math before Pi. It should be like this Math.Pi
<br />
Hope this will help, Sreng
Brian Schmitz
11,167 PointsThanks Sreng, you are correct. I actually figured out both of my questions in regards to the parseInt and the circumference variable challenge so I good to go. Thanks for your help.
Sreng Hong
15,083 PointsYour welcome
Brian Schmitz
11,167 PointsThanks as well, Shawn
Michael Hicks
24,208 PointsMichael Hicks
24,208 PointsI added quotes around "boxWidth" for some reason, thanks for posting the correct answer!