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 Basics (Retired) Working With Numbers Doing Math

Chandler Tayek
Chandler Tayek
5,513 Points

A simple basic solution to the "How old I'm I in seconds challenge."

I noticed a lot of students where unsure if they where getting the correct answer for the challenge so I decided to add a few lines (That Dave taught us, nothing fancy) in order to check to see if you got the correct answer.

Click on this link to check your age in years: http://codepen.io/ChandlerTayek/pen/xGXKKa

For those of you feeling ambitious I challange you to click the fork button at the top bar in codepen and account for leap year + date of birth.

Please feel free to link students to this post if they want to check their code or get the answer to how old they are in seconds using my application.

(Disclaimer I did not include any leap years or leap seconds nor did I incorporate the actual month or date of birth.In other words this is a rough total. This is also based off of 364 day year which is what Dave McFarland used in the video.)

That's the most logical way to come up with a solution for the task at hand, I am wondering why it outputs the


Time calculator

There are 86400 seconds in a day

in the browser not executing the prompt in line 6 [var yearsAlive = prompt("How old are you:");]

3 Answers

chandler, thanks for doing that, it's nice to have a double check on my work.

jennifer ray
jennifer ray
7,875 Points

Thank you same as above excellent to be able to check I got correct answer great work :)

thanks