JavaScript For Loop


JavaScript For Loop

  1. Consider the following code snippet.
    for(var n in m)
    console.log(m[n]);

    The above code is equivalent to which code?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    The in variable does the same task of traversing the array starting from the 0 index. The for/in loop makes it easy to do the same that we do using a for.