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

Math Objects

I cant pass math objects the first objective I need help The topic is Numbers the question is 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.

If you are still having issues after trying out Greg Shilling's tips, show us your code.

It's hard for us to know what issue you are having without seeing it. For some tips on how to do that, check out the tips for asking questions video located in the right hand sidebar.

Also without a link to the code challenge you are having issues with someone would have guess which one it is, to be able to test out their solution.

2 Answers

The comment in the script tells you the formula to calculate the circumference of a circle (pi * diameter)

Not sure what you mean by not being able to pass math objects. Perhaps you're not using the capital letter M?

Try typing in Math.PI in the console, that should give you pi (if it returns a ReferenceError, you've most likely forgotten to capitalize the M in Math). The next step is to use it in your equation to get the circumference.

This code challenge still makes no sense to me. Too hard :(

I 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;