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++ }
निम्नलिखित में से कौन सा कोड सबसे कुशल है?
Code 1 for(var number-10;number>=1;number--) { document.writeln(number); }
Code 2 var number=10; while(number>=1) { document.writeln(number); number++ }
Code 2 is incorrect which infinite loop i.e. its never end because it increase the variable value by one and condition is >=1that never meet.