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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started