Change Password
Logout
Update Question
View
Question
<p dir="ltr">Which is a more efficient JavaScript code snippet?</p> <p dir="ltr">Code 1 :</p> <p dir="ltr">// for loop in javascript</p> <p dir="ltr">for(var num=10;num>=1;num--)</p> <p dir="ltr">{</p> <p dir="ltr"> document.writeln(num);</p> <p dir="ltr">}</p> <p dir="ltr">Code 2 :</p> <p dir="ltr">var num=10;</p> <p dir="ltr">while(num>=1)</p> <p dir="ltr">{</p> <p dir="ltr"> document.writeln(num);</p> <p dir="ltr"> Num++;</p> <p dir="ltr">}</p> <p> </p>
Option 1
<p>code 1</p>
Option 2
<p>code 2</p>
Option 3
<p>Both Code 1 and Code 2</p>
Option 4
<p>Cannot Compare</p>
Correct Answer
Option 1
Option 2
Option 3
Option 4
Submit
Design and Developed by
O7Solutions