Q. If the following piece of JavaScript code is executed, will it work if not, what kind of possible error can occur?
Code:function fun(o)
{
for(;o.next; oo =o.next);
return o;
}
Dear candidates you will find MCQ questions of JavaScript here. Learn these questions and prepare yourself for coming examinations and interviews. You can check the right answer of any question by clicking on any option or by clicking view answer button.
Share your questions by clicking Add Question
function fun(o)
{
for(;o.next; oo =o.next);
return o;
}
while (x !=0)
{
if(x ==1)
continue;
else
x++;
}
Let's solve it carefully.
In this JavaScript code:
while (x != 0)
{
if (x == 1)
continue;
else
x++;
}
Thus:
The "continue" keyword is used for skipping the rest of the statements in that particular iteration.
Final Answer:
(C) It is used for skipping the rest of the statements in that particular iteration
functionfun(int length)
{
int a=5;
for(inti=0;i<length;i++)
{
console.log(a);
}
}
fun(2);
var a=0;
var b =0;
while (a <3)
{
a++;
b += a;
console.log(b);
}
var size=5;
var x=5;
var size=4;
for(var j=size;j>=0;j--)
{
console.log(x);
xx=x-2;
}
var x=0; for(x;x<10;x++); console.log(x);
<script>
function fun(0){
if(0===undefined)
debugger;
}
</script>