0 votes
in JavaScript by

What output we may get if we execute the following JavaScript code:

<script>  

function myFunction() {  

  

  var i;  

  for (i = 0; i< 5; i++) {  

    if (i === 3) {  

      continue;  

    }  

document.write(i);  

  }  

  

}  

myFunction();  

</script>  
 

a) 0124

b) 01234

c) It will throw a error

d) No output

1 Answer

0 votes
by

Answer: A

Reason: In the above-given code, the "continue" keyword mentioned which is commonly used in loops for skipping the specific iteration of a loop and jumping to the next iteration of the loop without exiting the loop's body. As you can see in the above code when the value of variable "i" gets equal to the 3, the "continue" keyword executed and control skips current iteration and jump to the next iteration.

Related questions

0 votes
asked Mar 23, 2021 in JavaScript by sharadyadav1986
0 votes
asked Mar 21, 2021 in JavaScript by rajeshsharma
...