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 trialShane Hague
Front End Web Development Techdegree Student 4,970 Pointsperson.age + 1 isn't adding 1 to make the number 38, it is making it 371
const person = { name: 'Edward', city: 'New York', age: '37', isStudent: true, skills: ['JavaScript', 'HTML', 'CSS'] };
person.nickname = 'Duke';
const message = Hi, I'm ${person.name}. I live in ${person.city}. Most know me as ${person.nickname}. My age is ${person.age + 1}.
;
console.log(message);
1 Answer
Ismael Liriano
11,490 PointsHi! That's because you set the value of age as a string, so instead of adding the number 1, you are concatenating the strings. Set the value of age as a number
Shane Hague
Front End Web Development Techdegree Student 4,970 PointsShane Hague
Front End Web Development Techdegree Student 4,970 PointsThat makes sense! Thanks!