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 trialDillon Carter
6,364 PointsCode Challenge: The Math Object - Step 4
Step 4 :
var diameter = 5.75,
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);
var circumference = (Math.PI * 5.75);
console.log (circumference);
var chance = Math.random() * (0, 20);
var maxWidth = Math.max (a, b, c);
var age = Math.floor (0);
I am honestly lost on this last step. I know the answer is not 0 but I cannot figure this out. I have gone through Google countless times trying to figure it out. I am sure it's something very simple I am just overlooking or overthinking. Any help?
Mike Bronner
16,395 PointsThanks! :)
3 Answers
Mike Bronner
16,395 PointsIn your code you are flooring the value 0 -- you need to floor the variable ageIfILiveToYear2100
.
Dillon Carter
6,364 PointsIt worked! Thank you so much. I was confused on this step. I thought I needed to use a number as the variable and not the actual variable...... I need to wrap Java more around my head lol.
Again thank you for helping me get through this challenge!
Mike Bronner
16,395 PointsExcellent! (Don't confuse JavaScript with Java -- they actually have nothing to do with each other.) :)
Dillon Carter
6,364 PointsOh..... I thought Java was short for Javascript..... And my newb flag is flying!
Mike Bronner
16,395 PointsMike Bronner
16,395 PointsPlease provide a link to the challenge.