ExamVeda
Login
Home
This question belongs to Javascript Basic And Variables
Basic and Variables
?

Consider the following code snippet
function printArray(a) 
{
     var len = a.length, i = 0;
     if (len == 0)
        console.log("Empty Array");
     else 
     {
         do 
         {
             console.log(a[i]);
         } while (++i < len);
     }
}
What does the above code result?

Answer & Solution
Correct Answer: Option A
The do/while loop is less commonly used when compared to the while loop. Here, it prints from the array in the given order.
Examveda
Question posted by Examveda
Community

Join the Discussion

1 Comment
Saurab Rakshit
Saurab Rakshit 7 years ago
how it print numbers, it is an empty array with undefined length .......how Option A is the answer