41
Consider the following code snippet
What does the above code result?
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);
}
} Answer & Solution
Answer: Option
A
Solution:
The do/while loop is less commonly used when compared to the while loop. Here, it prints from the array in the given order.