0 votes
in JavaScript by
Which of the following options would be the correct output for the given JavaScript code?

var x=0;  

for(x;x<10;x++);  

console.log(x);  

a) 10

b) error

c) 4

d) 5

1 Answer

0 votes
by

Answer: A

Reason: The variable's value will increase until it gets equal to 10, then the control will exit the loop's definition. There are no other statements to be executed in the definition of the loop,only the value of the variable "x" will be incremented, and the output will be 10.

...