Guest User

Untitled

a guest
May 26th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.46 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <body>
  4.  
  5. <p>In this example, the continue statement refers to the for loop labeled "Loop2". When j is equal to 12, the continue statement will "jump over" this value and cause "loop2" to go to the next iteration.</p>
  6.  
  7. <button onclick="myFunction()">Try it</button>
  8.  
  9. <p id="demo"></p>
  10.  
  11. <script>
  12. function myFunction() {
  13. var text = "";
  14. var i, j;
  15.  
  16. Loop1: // The first for loop is labeled "Loop1"
  17. for (i = 0; i < 3; i++) {
  18. text += "<br>" + "i = " + i + ", j = ";
  19.  
  20. Loop2: // The second for loop is labeled "Loop2"
  21. for (j = 10; j < 15; j++) {
  22. if (j === 12) {
  23. continue Loop2;
  24. }
  25. console.log(text += j + " ")
  26. // document.getElementById("demo").innerHTML = text += j + " ";
  27. }
  28. }
  29.  
  30. }
  31. </script>
  32.  
  33. <script id="jsbin-javascript">
  34. let myFunct = () => {
  35.  
  36. let i,j;
  37.  
  38. let result = [];
  39. for(i = 0; i < 3; i++){
  40. let text = '';
  41. text += '' + 'i = ' + i +' ;'+ ' j = '+' ';
  42. for(let j = 10; j < 15; j++){
  43. if(j === 12){
  44. continue;
  45. }
  46. text += j + ' ';
  47. }
  48. result.push(text)
  49. }
  50. console.log(result)
  51. }
  52.  
  53. myFunct()
  54. </script>
  55.  
  56. <script id="jsbin-source-html" type="text/html"><!DOCTYPE html>
  57. <html>
  58. <body>
  59.  
  60. <p>In this example, the continue statement refers to the for loop labeled "Loop2". When j is equal to 12, the continue statement will "jump over" this value and cause "loop2" to go to the next iteration.</p>
  61.  
  62. <button onclick="myFunction()">Try it</button>
  63.  
  64. <p id="demo"></p>
  65.  
  66. <script>
  67. function myFunction() {
  68. var text = "";
  69. var i, j;
  70.  
  71. Loop1: // The first for loop is labeled "Loop1"
  72. for (i = 0; i < 3; i++) {
  73. text += "<br>" + "i = " + i + ", j = ";
  74.  
  75. Loop2: // The second for loop is labeled "Loop2"
  76. for (j = 10; j < 15; j++) {
  77. if (j === 12) {
  78. continue Loop2;
  79. }
  80. console.log(text += j + " ")
  81. // document.getElementById("demo").innerHTML = text += j + " ";
  82. }
  83. }
  84.  
  85. }
  86. <\/script>
  87.  
  88. </body>
  89. </html>
  90. </script>
  91.  
  92.  
  93. <script id="jsbin-source-javascript" type="text/javascript">let myFunct = () => {
  94.  
  95. let i,j;
  96.  
  97. let result = [];
  98. for(i = 0; i < 3; i++){
  99. let text = '';
  100. text += '' + 'i = ' + i +' ;'+ ' j = '+' ';
  101. for(let j = 10; j < 15; j++){
  102. if(j === 12){
  103. continue;
  104. }
  105. text += j + ' ';
  106. }
  107. result.push(text)
  108. }
  109. console.log(result)
  110. }
  111.  
  112. myFunct()</script></body>
  113. </html>
Add Comment
Please, Sign In to add comment