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 trialemmanuelsantana
2,415 PointsWhy is this code incorrect? let i = 1; do { console.log( `#${i}` ); i += 1; } while ( i <= 15 )
let i = 1;
do {
console.log( #${i}
);
i += 1;
} while ( i <= 15 )
RESULT ON CONSOLE:
"#1" "#2" "#3" "#4" "#5" "#6" "#7" "#8" "#9" "#10" "#11" "#12" "#13" "#14" "#15"
1 Answer
Jennifer Nordell
Treehouse TeacherHi there, emmanuelsantana ! Check the output that's supposed to be there again. It's not supposed to count from one to 15, but rather every odd number from one to 15. The output should be:
#1
#3
#5
#7
#9
#11
#13
#15
Note that 2, 4, 6, 8, 10, 12, and 14 are missing which means you need to increment by 2 instead of 1.
Hope this helps!
newwebcoder
13,061 Pointsnewwebcoder
13,061 PointsAre you including backticks in
console.log( `#${i}`)
? Title of your question seems to have properly working code.