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 trialPratibha Soni
7,561 PointsThe Math Object....
"Create a variable named "circumference" and assign the correct value to it by using the "diameter" variable and Math.PI. See the comment in the script for more information."
This is question which doesn't let me pass.....wanted help.... I wrote the answer : var circumference = Math.PI(5.75, 3.14159); & I tried to apply .. Math.PI(diameter); But still it didn't recognize the var....... What should I try then.....?
7 Answers
Elijah Collins
19,457 PointsI just figured it out myself if you still need help.
So after you name the var use diameter as an argument then multiple it by Pi, ie...
var circumference = (diameter) * Math.PI;
Leslie Phifer
21,450 PointsMath.PI is a property, not a method. You cannot pass a variable into it--it is a variable. Instead, multiply it by your diameter.
Pratibha Soni
7,561 PointsThanks so much for your reply......it worked......
jeff206
17,569 PointsAlex if you still in trouble yet. Use this code var circumference = Math.PI * ( diameter);
Alex Giuseppe Ispas
Courses Plus Student 1,103 PointsCan someone help me finish this challenge, I still can not figure out what exactly I should write to get this done.
Alex Giuseppe Ispas
Courses Plus Student 1,103 PointsCan someone help me finish this challenge, I still can not figure out what exactly I should write to get this done.
Evan Z
8,938 Pointsvar circumference = Math.PI*diameter;
Make sure to check all the spelling.
Chris Scarinci
Courses Plus Student 3,624 PointsI can't believe how easy it was once I figured it out lol, I was putting it above the var diameter. Hope this helps someone else. var diameter = 5.75, circumference = diameter * Math.PI a = 17, b = 42, c = 1337, ageIfILiveToYear2100 = (new Date(2100, 0, 1) - new Date(1995, 5, 16, 7, 20)) / (1000 * 60 * 60 * 24 * 365.242);