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 Complete the Loop

why does this keep crashing my browser???

im trying to take this code to see whats wrong with it, and whenever i use workspace, and open this code, it crashes my browser, wether it mozilla or firefox

script.js
var counter = 1;
while (10) {
    document.write("<p>Now in loop #" + counter + "</p>");
    counter + 1;
}

1 Answer

while (counter < 10) and counter++; not counter +1 :)

your while is like while 10 = 10 xD its always TRUE so INFINITY LOOP :)

oh ok xD, ty i was really confused for a bit

np :) mark me as ANSWERE :)