Step 3: show all posts
toArray(posts).forEach(function(postToAdd) {
drawElement(postToAdd);
});What this code do?
How to use forEach
var arr = ['a', 'b', 'c', 'd'];Last updated
toArray(posts).forEach(function(postToAdd) {
drawElement(postToAdd);
});var arr = ['a', 'b', 'c', 'd'];Last updated
arr.forEach(function(value, index) {
console.log(index, value);
});
//Will log:
// 0 "a"
// 1 "b"
// 2 "c"