Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kevinchisholm/69c8a75df1ef90596931e1d815b12e78 to your computer and use it in GitHub Desktop.
Save kevinchisholm/69c8a75df1ef90596931e1d815b12e78 to your computer and use it in GitHub Desktop.
var arr = ["monday","tuesday","wednesday","thursday","friday"];
console.log(arr.length); //5
var arr = ["monday","tuesday","wednesday","thursday","friday"],
len = arr.length - 1;
for (var i = 0; i <= len; i++){
console.log( "The value of element # " + i + " is: " + arr[i] );
}
The value of element # 0 is: monday
The value of element # 1 is: tuesday
The value of element # 2 is: wednesday
The value of element # 3 is: thursday
The value of element # 4 is: friday
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment