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

Kris oi
Kris oi
4,910 Points

mathematic shorthands

var yearibeenalive = 5;

var secperminute = 60;

var minsperhour = 60;

var hoursperday = 24;

var daysperweek = 7;

var weeksperyear = 52;

var secondsperweek = secperminute * minsperhour * hoursperday * daysperweek;

var secondsperweek *= weeksperyear; <-------

THE SHORTHAND ISN'T WORKING

1 Answer

andren
andren
28,558 Points

The issue is your use of the var keyword. var is used to create new variables, it should not be used when referencing existing ones. If you remove it like this:

secondsperweek *= weeksperyear;

Then your code should work.

Kris oi
Kris oi
4,910 Points

haha...my usual dumb overlooked mistake... thanks