Zoic JS methods Flashcards
Array.reduce()
Must create a callback function to use with it. Is able to reduce an array of numbers based on the callback function used with it. (previousValue and currentValue)
String.includes()
Checks whether one string is found in the string it’s called on. Returns true or false.
Array.entries()
Returns a new array iterator that contains a key/value pair for each index of the array.
Object.keys()
Method that returns an array of the object.
Array.forEach()
Method that executes a provided function once for each array element.
array.forEach(element => console.log(element))
Object.assign()
Method that copies all properties from one or more source objects and modifies the target object. Returns the modified target object.
Array.from()
Method that creates a new array instance of the array or string.
Array.reverse()
Method that reverses an array. The first array element becomes the last, the last array element becomes the first.
Array.join()
Method that creates and returns a new string by concatenating all of the elements in an array. join() or join(separator)
Document.createElement
Method that creates the HTML element by tagName. let element = document.createElement(tagName)
Node.textContent
document.getElementById(tagName).textContent = ‘text’
element.appendChild()
Allows an element to be appended to a parent element.
element.appendChild(child element)
HTMLElement.style
Returns the inline style of the element in the form of a CSS Style Declaration object.
style = element.style
HTML DOM changing CSS
document.getElementById(id).style.color = “blue”