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 The Math Object

Diana Lescure
Diana Lescure
11,455 Points

Exercise Bug

The first exercise asks to declare a variable named "circumference" and then store the Math.PI() inside of it, when I do that, it says I haven't declared the variable, I've tried everything, is not working, help.

James Barnett
James Barnett
39,199 Points

I noted you referenced Math.PI(), it's important to remember Math.PI is a constant not a function.

I just realized a problem here, you haven't gotten to the function section in the course. And I don't think the course touched on constants. So that's a problem.

1 Answer

Hello,

It's been a long time and I had to look at it for a little bit until I realized what it was asking for. What were you using that made it not pass? In the challenge, the variable must have a value in it after getting declared for the challenge to even realize that you declared it (it doesn't see the variable if you just declare it). Remember that the circumference is the diameter multiplied by PI. Make sure you use the diameter variable that is already defined as well as the Math object PI. You can get the value of PI from the Math object by calling it like so: Math.PI

Once you put it all together (either on it's own declaration or as part of the variables that are already being declared) the challenge will pass. Hope this helps you.

Cheers!