Question: Testing Break using the Console: Create an infinite while loop. note: this may lock up your browser. You may want to code this in a

Testing Break using the Console:

Create an infinite while loop. note: this may lock up your browser. You may want to code this in a blank page and use a debugger. Do not use alert! Use the constant 2 for the conditional in the while loop: while(2)

This loop will run forever because 2 is a constant and will always be true. (Be careful, you may have to restart the browser!) In fact, false is only: 0, null, undefined, false, or "" anything else is considered true.

You will need to use break; to get out of this loop. Each iteration of the loop will log a counter number. Only log out 4 lines to match the required output.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!