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 trialCody Tapp
9,667 PointsNot sure what's wrong. Keeps saying to make sure let us in the for in loop
const composer = {
name: 'Edward Ellington',
nickname: 'Duke',
genres: ['jazz', 'swing'],
instrument: 'piano'
};
for(let key in composer){
console.log(key);
}
for (let prop in composer) {
console.log( `${prop}: ${composer[prop]}`);
Cody Tapp
9,667 PointsMichael Kobela I made a mistake and had an old clipboard copy pasted in the code. See the new change.
It keeps saying βbe sure to use let in the for loopβ obviously itβs there.
Michael Kobela
Full Stack JavaScript Techdegree Graduate 19,570 PointsFrom what I see your for loop is missing the closing } :
for (let prop in composer) {
console.log( `${prop}: ${composer[prop]}`);
}
1 Answer
Martin Sole
82,199 PointsHi
You have the correct answer in your code, but your answer just needs tweaking. The the second part of the challenge is asking you to also include the values as well as the property names, which you have correctly done, but it wants you to add this to the for loop created in the first step rather than creating a second a for loop.
Cody Tapp
9,667 PointsThanks, that worked. They should've said to replace the previous rather than what it asked.
Michael Kobela
Full Stack JavaScript Techdegree Graduate 19,570 PointsMichael Kobela
Full Stack JavaScript Techdegree Graduate 19,570 PointsIn the final console.log, you missing the + before composer.prop:
console.log(prop, ': ' + composer.prop);