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 trialHarsh Ahuja
2,618 PointsMath Object-I tried the below two it is not working?
var circumference = diameter*Math.PI(); var circumference= Math.round(Math.PI()*diameter);
2 Answers
Dino Paškvan
Courses Plus Student 44,108 PointsPI
is a property of the Math
object, not a function (method). It's not invoked with parentheses. To get the value of pi, just do Math.PI
, or rather, treat it the same way you would any other variable.
Harsh Ahuja
2,618 PointsThanks Dino