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

My years alive

const secondsPerMin = 60; const minsPerHour = 60; const hoursPerDay = 24; const daysPerWeek = 7; const weeksPerMonth = 52; const yearsAlive = 30;

secondsAlive = secondsPerMin * minsPerHour * hoursPerDay * daysPerWeek * weeksPerMonth * yearsAlive;

console.log(I've lived ${secondsAlive} Seconds since I was born);

3 Answers

Grzegorz Zielinski
Grzegorz Zielinski
5,838 Points

In console.log command at the end of your script you've forgotten to add Template literals, that's why console.log command takes everything you typed in between brackets as a variable. Correct way of writing console.log command which includes template literals should look like that:

console.log(`I've lived ${secondsAlive} Seconds since I was born`);

Hope it helps!

Nicole Antonino
Nicole Antonino
12,834 Points

You forgot the template literals (``) in your console.log

console.log(`I've lived ${secondsAlive} Seconds since I was born`);

Thank you. Got that, it worked.