Breaking Down MDN Documents

const array = [element, element, element]array.forEach(element => {
Something here
})
//An example of an array of n objects with n key/value pairs
const array = [{key1: value, key2: value,... keyn: value}, ..., {}]
array.forEach(<concept>Obj => {
//If we wanted to put the first key into a div
<concept/key>Li.innerText = <concept>Obj.key1
})
const array1 = [5, 12, 8, 130, 44];const found = array1.find(element => element > 10);console.log(found);
// expected output: 12
const found = array1.find(element => element > 10) <a variable name to signify a result> = <name of the array to iterate over>.find(<variable name of the element we are going to iterate over> => <Some comparison or function that will have to return true>)
const words = ['spray', 'limit', 'elite', 'exuberant', 'destruction', 'present'];const result = words.filter(word => word.length > 6);console.log(result);
// expected output: Array ["exuberant", "destruction", "present"]
const words = [{id: 1, word:'spray'}, {id: 2, word:'limit'}, {id: 3, word:'elite'}, {id: 4, word:'exuberant'}, {id: 5, 'word: destruction'}, {id: 6, word:'present'}];const result = words.filter(wordObj => wordObj.word === "elite");console.log(result)
//expected output: Array [{id: 3, word:"elite"}]

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store