Skip to content

Instantly share code, notes, and snippets.

@uniquename
Created July 24, 2017 16:43
Show Gist options
  • Save uniquename/76f5d9e1d097dd89ad1ecc8e66feb4cc to your computer and use it in GitHub Desktop.
Save uniquename/76f5d9e1d097dd89ad1ecc8e66feb4cc to your computer and use it in GitHub Desktop.
var myArray = ['Apples', 'Bananas', 'Pears', 'Oranges'];
/*
var myArray = [{
id: 55675,
title: 'hey there',
body: 'that where really great news!'
}, {
id: 55676,
title: 'oh really?!',
body: 'thats nice to hear!!!'
}];
*/
//console.log(myArray.length);
for (var counter = 0; counter < 5; counter++) {
console.log(counter);
}
/*
for (var i = 0; i < myArray.length; i++) {
console.log(myArray[i]);
}
/*
myArray.forEach(function(item){
console.log(item);
});
var logArrayElements = function (element, index, array) {
console.log('a[' + index + '] = ' + element);
}
myArray.forEach(logArrayElements);
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment