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 trialTural Rzazade
3,750 PointsMyCode
const secsPerMin = 60;
const minsPerHour = 60;
const hoursPerDay = 24;
//const daysPerWeek = 7;
//const weeksPerYear = 52;
//
//secondsPerDay = secsPerMin * minsPerHour * hoursPerDay;
//
//console.log(`There are ${secondsPerDay} seconds in a day.`)
const yearsAlive = 24;
const daysPerYear = 365;
const secsAlive = secsPerMin * minsPerHour * hoursPerDay * daysPerYear;
console.log(`I've been alive for more than ${secsAlive} seconds!`);
5 Answers
Steven Parker
231,248 PointsI'm guessing there's no question or error here, but this is just a response to the instructor's suggestion in the video of "when you're done, why don't you share your solution with other Treehouse students?"
josephweiss2
7,094 PointsNicely done!!! Go further with your excellent coding!!
Tural Rzazade
3,750 PointsThank you guys! :) Everything is fine! I know it seems a little strange to post your code by using "Get help" button, but as you guessed I did it according to Guil's suggestion. 👻
Luz Bautista
UX Design Techdegree Graduate 21,750 PointsHere is my solution, I left the previous code in place so I could use the secondsPerDay variable and shorten the math a bit.
const secPerMin = 60;
const minsPerHour = 60;
const hoursPerDay = 24;
const daysPerWeek = 7;
const weeksPerYear = 52;
const secondsPerDay = secPerMin * minsPerHour * hoursPerDay;
console.log(`There are ${secondsPerDay} seconds in a day.`);
const yearsAlive = 44;
const daysPerYear = 365;
const secondsAlive = secondsPerDay * daysPerYear * yearsAlive;
console.log(`I've been alive for more than ${secondsAlive} seconds!`) ```
josephweiss2
7,094 PointsNice Work!!
jessicakincaid
21,833 Pointsjessicakincaid
21,833 PointsDo you have a question? Are you receiving an error?