Which Is A More Efficient Javascript Code Snippetbr Code 1 P #52
Which is a more efficient JavaScript code snippet?<br /> Code 1 : </p> <pre><code class="language-javascript"> for(var num=10;num>=1;num--) { document.writeln(num); } </code></pre> <p>Code 2 : </p> <pre><code class="language-javascript"> var num=10; while(num>=1) { document.writeln(num); num++; } </code></pre>
This multiple choice question (MCQ) is related to the book/course gs gs106 Javascript. It can also be found in gs gs106 Lexical Structures - JavaScript Statements - Quiz No.1.
Which is a more efficient JavaScript code snippet?
Code 1 :
Code 1 :
for(var num=10;num>=1;num--) { document.writeln(num); }
Code 2 :
var num=10; while(num>=1) { document.writeln(num); num++; }
Code 1
Code 2
Both Code 1 and Code 2
Cannot Compare
Similar question(s) are as followings:
Online Quizzes of gs106 Javascript
Graphics and Rendering in JavaScript - Scripted Media - Quiz No.1
gs gs106 Javascript
Online Quizzes