Which of the following code is most efficient?
Which of the following code is most efficient?
निम्नलिखित में से कौन सा कोड सबसे कार्यक्षम है?
Code 1;
for(var number=10;number>=1;number–)
{
document.writeln(number);
}
Code 2;
var number=10;
while(number>=1)
{
document.writeln(number);
number++;
}
Detailed Solution & Logic
Code 1/कोड 1
कोड 1 अधिक कुशल होगा वास्तव में, दूसरा कोड रनटाइम एरर का सामना कर सकता है क्योंकि संख्या का नाम कभी भी एक के बराबर या उससे कम नहीं होने वाला है।
Similar Practice Questions
Which tag is the first tag of an HTML page?
Which tag is the first tag of an HTML page? कौन-सा टैग HTML पेज का...
Which among the following is/are NOT a feature of W3.CSS?
Which among the following is/are NOT a feature of W3.CSS? निम्नलिखित में से कौन W3.CSS...
Which of the following is supported by HTML5?
Which of the following is supported by HTML5? निम्नलिखित में से कौन HTML5 द्वारा Support...
Which of the following is a popular front-end framework for building user interfaces in JavaScript?
Which of the following is a popular front-end framework for building user interfaces in JavaScript?...
Rectangular purpose of: Marquee tool is used for the
Rectangular purpose of: Marquee tool is used for the रेक्टेंगुलर मार्की टूल का उपयोग____ के...
In a HTML page, if the background image is smaller than the screen, what will happen?
In a HTML page, if the background image is smaller than the screen, what will...
Which feature is used to combine cells vertically? / कोशिकाओं को लंबवत…
Which feature is used to combine cells vertically? कोशिकाओं को लंबवत रूप से संयोजित करने...