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

Abigail Puckett
Abigail Puckett
2,111 Points

My solution

Just to let you be able to plug in all different ages.

let yearsAlive = prompt("How old are you in years?");

const secsPermin = 60; const minsPerHour = 60; const hoursPerDay = 24; const daysPerWeek = 57; const weeksPerYear = 52;

const secondsPerDay = secsPermin * minsPerHour * hoursPerDay; console.log(There are ${secondsPerDay} seconds in the day.);

const secondsPerYear = secondsPerDay * daysPerWeek * weeksPerYear; console.log(There are ${secondsPerYear} seconds in a year.);

const secondsAlive = secondsPerYear * yearsAlive; console.log(You have been alive for more than ${secondsAlive} seconds!);

Steven Parker
Steven Parker
231,248 Points

When posting code, always use Markdown formatting to preserve the code's appearance and retain special symbols (such as accents). Take a look at this video about Markdown formatting. Afterwards, you can edit this question and add the formatting marks.