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 JavaScript Loops, Arrays and Objects Simplify Repetitive Tasks with Loops Create a while Loop

idriss Elouilani
PLUS
idriss Elouilani
Courses Plus Student 1,232 Points

create loop

I tried to create while loop that prints to the document 26 times . we have added variable named count. use it to track numbers of times the loops runs. don't forget to use document.write () method inside the loop

script.js
var count = 0;
while (count<26){
  document.write("<p> count 26 #" + count +"</P>");
  count+=!
} 

What is the hashtag for?

5 Answers

Christopher De Lette
PLUS
Christopher De Lette
Courses Plus Student 7,139 Points

Currently you have

 count+=!

where it needs to increment by a value, say 1. Hope this helps.

Take care and Happy Coding!

Christopher De Lette
PLUS
Christopher De Lette
Courses Plus Student 7,139 Points

Hi idriss Elouilani

Your JS snippet looks fine except you might want to take a second glance at your increment value in the count variable. I think this will solve your question.

Take care and Happy Coding!

idriss Elouilani
PLUS
idriss Elouilani
Courses Plus Student 1,232 Points

what do you mean increment value ? in count variable, sorry chris I didn't it.

Christopher De Lette
Christopher De Lette
Courses Plus Student 7,139 Points

Perfect! Glad i could help. Please close this question by marking the "best answer" and have wonderful day!

Chris