FlashKeepers

JavaScript · JavaScript · College and University

JavaScript Arrays and Objects

Array and object methods, iteration, and manipulation in JavaScript.

About this set

41 basic cards for JavaScript JavaScript. It opens with "What does Array.push() do?" and "What does Array.pop() do?". More College and University decks are listed below.

41 cards · basic cards · AI-written, checked twice. Edit anything.

Study this set free Look inside first Get FlashKeepers for iPhone

Opens in your browser, no account. Get the iPhone and iPad app · Android app

What does Array.push() do?
Show answerAdds one or more elements to the end of an array and returns the new length. Mutates the original array.
What does Array.pop() do?
Show answerRemoves the last element from an array and returns that element. Mutates the original array. Returns undefined if array is empty.
What does Array.shift() do?
Show answerRemoves the first element from an array and returns that element. Mutates the original array. Returns undefined if array is empty.
What does Array.unshift() do?
Show answerAdds one or more elements to the beginning of an array and returns the new length. Mutates the original array.
What does Array.slice() do?
Show answerReturns a shallow copy of a portion of an array. Does not mutate the original array. Takes start and end indices.
What does Array.splice() do?
Show answerRemoves elements from an array and optionally inserts new elements. Mutates the original array and returns an array of removed elements.
What does Array.concat() do?
Show answerCombines two or more arrays into a new array. Returns a new array and does not mutate the originals.
What does Array.join() do?
Show answerCombines all array elements into a single string, separated by a specified separator. Default separator is comma.
What does Array.indexOf() do?
Show answerReturns the index of the first element that matches the search value. Returns -1 if not found.
What does Array.includes() do?
Show answerChecks whether an array contains a specified element and returns a boolean. More readable than indexOf for simple presence checks.
What does Array.reverse() do?
Show answerReverses the order of elements in an array in place. Mutates the original array and returns a reference to it.
What does Array.sort() do?
Show answerSorts elements in an array in place. By default sorts lexicographically as strings. Takes optional comparison function.
What does Array.map() do?
Show answerTransforms each element in an array using a callback function and returns a new array. Does not mutate the original array.
What does Array.filter() do?
Show answerCreates a new array with elements that pass the test in the callback function. Does not mutate the original array.
What does Array.reduce() do?
Show answerAccumulates array elements into a single value by applying a callback function. Takes a callback and optional initial value.

26 more cards in the app

Study this set free