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 trialDeMarcus Rush
5,378 PointsError with checker
I am entering the code var circumference = Math.pi(diameter) which appears to be right. I am lost on why it is not accepting it.
2 Answers
Dino Paškvan
Courses Plus Student 44,108 PointsMath.PI
is a constant, not a method, so you have to use it as you would use a variable. So, the circumference is the diameter multiplied by Pi.
Also, since JavaScript is case-sensitive, make sure you type both P
and I
as capital letters.
var circumference = Math.PI * diameter;
Michael Hulet
47,913 PointsThe only think I immediately spot wrong with your code is that you don't use a semicolon at the end of your line
Dino Paškvan
Courses Plus Student 44,108 PointsSemicolons are not always mandatory in JavaScript. They are good practice, though.
However, in this case, the lack of the semicolon isn't really what's causing the issue.