Advertisement
Guest User

Untitled

a guest
Jan 18th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta name="description" content="[Loops]">
  5. <meta charset="utf-8">
  6. <meta name="viewport" content="width=device-width">
  7. <title>JS Bin</title>
  8. </head>
  9. <body>
  10.  
  11. <script id="jsbin-javascript">
  12. //Looping
  13. //for loop used to loop arrays
  14.  
  15. //counter is initialized
  16. var index = 0
  17.  
  18. //Program is told to stop looping
  19. //index < names.length;
  20.  
  21. //increment index increases by one each time a loop occurs
  22. //index++
  23. for(var index = 0; index < names.length; index++);
  24.  
  25. //looping backwards
  26. //increment is instead decreasing by one each time a loop occurs
  27. //index--
  28. for(var index = names.length -1; index > -1, index--);
  29.  
  30. //while loop
  31. //looks through block of code while certain conditions are true
  32. var i = 22;
  33. while( i > 10) {
  34. return ("Grats");
  35. }
  36.  
  37. //for in loop
  38. </script>
  39.  
  40.  
  41.  
  42. <script id="jsbin-source-javascript" type="text/javascript">//Looping
  43. //for loop used to loop arrays
  44.  
  45. //counter is initialized
  46. var index = 0
  47.  
  48. //Program is told to stop looping
  49. //index < names.length;
  50.  
  51. //increment index increases by one each time a loop occurs
  52. //index++
  53. for(var index = 0; index < names.length; index++);
  54.  
  55. //looping backwards
  56. //increment is instead decreasing by one each time a loop occurs
  57. //index--
  58. for(var index = names.length -1; index > -1, index--);
  59.  
  60. //while loop
  61. //looks through block of code while certain conditions are true
  62. var i = 22;
  63. while( i > 10) {
  64. return ("Grats");
  65. }
  66.  
  67. //for in loop</script></body>
  68. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement