Progress #3

Was doing some studying with JavaScript via http://www.learn-js.org/en/Loops.

I was testing this code:

var i = 99;
while (i > 0)
{
    console.log(i + " bottles of beer on the wall");
    i -= 1;
}

It worked fine in Chrome Developer tools, Console menu.
It displays from 1 to 99 bottles of beer on the wall in a loop.

Crazy me, I switched – sign to a + sign without thinking. DO NOT ATTEMPT THIS!!

var i = 99;
while (i > 0)
{
    console.log(i + " bottles of beer on the wall");
    i += 1;
}

Guess what happened? My Chrome crashed, It will go from 99 and beyond space. In an infinite loop…I couldn’t close the tab. Silly me, should read the code carefully before executing it.

Solution:

In Chrome: Either Shift+ESC or Menu → More Tools → Task Manager.
Find the tab and click End process. It will stop the tab from running.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s