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

How is my response not generating?

var secondsPerMin = 60;
var minsPerHour = 60;
var hoursPerDay = 24;
var daysPerWeek = 7;
var weeksPerYear = 52;
var daysPerYear = 365;
var yearsAlive = 31;

var secondsPerDay = secondsPerMin * minsPerHour * hoursPerDay;
document.write('There are ' + secondsPerDay + ' seconds in a day');

var secondsAlive = secondsPerDay * daysPerYear * yearsAlive;
document.write('I have been on this earth for more than ' + secondsAlive ' and counting!');

I don't understand how the first document.write example renders correctly but not the second one I wrote. Any help? Thanks!

What is wrong with my code? why wont it run? am i missing something?

var secondsPerMinute = 60; var minsPerHour = 60; var hoursPerDay = 24; var daysPerWeek = 7; var weeksPerYear = 52; var secondPerDay = secondsPerMinute * minsPerHour * hoursPerDay; document.write('There are ' + secondsPerDay + ' seconds in a day');

2 Answers

Looks like you forgot a + sign on the second one after secondsAlive ...

how did you get your code to post to the forum? that never works for me

Copy it direct from the workspace and it should look like actual code...

ty kennedy, I'll give that a try