Quick actions

cmd+k|ctrl+k

Navigation

Languages

Traversing an Array

Snippet info

Language

JavaScript

Visibility

public

Author

peter

Created

2016-04-24T15:12:33Z

Updated

2016-04-27T04:08:21Z

// print all names in an array

function printNames(console) {
    var names = ["Ben", "Jafar", "Matt", "Priya", "Brian"],
      counter;
      
    for (counter = 0; counter < names.length; counter++) {
        console.log(names[counter]);
    }  
}

// Did we need to specify the order in which the names were printed?
// Why or why not?
INFO