πŸ“Š JavaScript
Q. Consider the following code snippet.
What does this code result?
Code:
function printArr(n) 
{
     var len = n.length, p = 2;
     if (len == 2)
        console.log("Nothing is in Array");
     else 
     {
         do 
         {
             console.log(n[p]);
         } while (++p < len);
     }
}
  • (A) Prints the numbers in the array in the reverse order
  • (B) Prints the numbers in the array in order
  • (C) Prints “Nothing is in Array”
  • (D) Prints 2 to the length of the array
πŸ’¬ Discuss
βœ… Correct Answer: (B) Prints the numbers in the array in order

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
180
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Manisha Agrawal
Publisher
πŸ“ˆ
92%
Success Rate