Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta name="description" content="[Loops]">
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width">
- <title>JS Bin</title>
- </head>
- <body>
- <script id="jsbin-javascript">
- //Looping
- //for loop used to loop arrays
- //counter is initialized
- var index = 0
- //Program is told to stop looping
- //index < names.length;
- //increment index increases by one each time a loop occurs
- //index++
- for(var index = 0; index < names.length; index++);
- //looping backwards
- //increment is instead decreasing by one each time a loop occurs
- //index--
- for(var index = names.length -1; index > -1, index--);
- //while loop
- //looks through block of code while certain conditions are true
- var i = 22;
- while( i > 10) {
- return ("Grats");
- }
- //for in loop
- </script>
- <script id="jsbin-source-javascript" type="text/javascript">//Looping
- //for loop used to loop arrays
- //counter is initialized
- var index = 0
- //Program is told to stop looping
- //index < names.length;
- //increment index increases by one each time a loop occurs
- //index++
- for(var index = 0; index < names.length; index++);
- //looping backwards
- //increment is instead decreasing by one each time a loop occurs
- //index--
- for(var index = names.length -1; index > -1, index--);
- //while loop
- //looks through block of code while certain conditions are true
- var i = 22;
- while( i > 10) {
- return ("Grats");
- }
- //for in loop</script></body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement