Arrays
C style for loop
for(let i=0; i<array.length; i++){}
for...of
Array, Map, Set, arguments
  • const arr = [3, 5, 7];
  • for (let i of arr) // logs 3, 5, 7
array.forEach(callback(value, index, array));
takes callback
Object
for...in
iterates over keys
Object.entries
returns array of key value pair array
  • {item: 'Jeans', quantity: 2}
  • [["item", "Jeans"], ["quantity", 2]]
Object.keys
returns array of keys
Object.values
returns array of values