How To Control A Loop In Javascript Let’s discuss on how you can control your loop in javascript program, here we will discuss on the the use of break and continue statements ,when you wish to come out of the loop without reaching the bottom or you just wish to skip a part of your code block and start a next iteration of the loop, remember to follow us in our social media platforms for more tutorials and live sessions we hold; 1. Break statement It is applied when you wish to exit the loop early, lets have a syntax for break statement. var x=1; while(x<20) { if(x==5){ break; //it breaks out of loop completely } x=x=1; document.write(x+ “<br />”); } 2. CONTINUE STATEMENT Continue statement tells the interpreter to skip the remaining code block and start a new iteration immediately. When it is encountered in a program it flows to the top to check the expression immediately and if the condition remains true it starts the iteration otherwise it comes out of the loop. L...
knowledge, Tutorials, information, programming, JAVA, CISCO,Python,Excel,source,codes,theory