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

Zach Hope
Zach Hope
12,486 Points

Document write also not working here.

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

can't get anything to show up in the preview , neither does it work with my copy and paste into sublime text.

Make sure you have already attached the external '.js' script file into the "index.html" file.

Tim Barbarino
Tim Barbarino
5,449 Points

Could you snapshot workspace? It's an icon in the top right corner.

Tim Barbarino
Tim Barbarino
5,449 Points

My guess is the same as Chau's. Check that you have-

<script src="<name of your script>.js"></script>

in your index.html file.

2 Answers

Zach Hope
Zach Hope
12,486 Points

Guys I feel really silly for not catching my mistake here but it’s actually just the variable “hourPerDay” it should be pluralized as “hoursPerDay” and that’s the whole issue !

Tim Barbarino
Tim Barbarino
5,449 Points

Don't feel silly! Most mistakes in my experience are to do with syntax and spelling!

I had trouble getting the document.write command to work as well, and it turned out that using the contraction "I've" was my ultimate issue.