Loading...
Preparing your coding drills
Comprehensive reference for 63 JavaScript methods across 8 categories.
filter
Creates a new array with all elements that pass the test implemented by the provided function.
map
Creates a new array populated with the results of calling a provided function on every element in the calling array.
reduce
Executes a user-supplied reducer callback function on each element of the array, passing in the return value from the calculation on the preceding element.
find
Returns the first element in the provided array that satisfies the provided testing function. If no values satisfy the testing function, undefined is returned.
findIndex
Returns the index of the first element in the array that satisfies the provided testing function. Otherwise, it returns -1.
forEach
Executes a provided function once for each array element. Returns undefined and cannot be chained.
some
Tests whether at least one element in the array passes the test implemented by the provided function. Returns true if it finds an element for which the callback returns truthy.
every
Tests whether all elements in the array pass the test implemented by the provided function. Returns true only if every element passes.
includes
Determines whether an array includes a certain value among its entries, returning true or false as appropriate.
slice
Returns a shallow copy of a portion of an array into a new array object selected from start to end (end not included).
splice
Changes the contents of an array by removing or replacing existing elements and/or adding new elements in place.
concat
Merges two or more arrays. This method does not change the existing arrays, but instead returns a new array.
sort
Sorts the elements of an array in place and returns the reference to the same array, now sorted.
reverse
Reverses an array in place and returns the reference to the same array.
flat
Creates a new array with all sub-array elements concatenated into it recursively up to the specified depth.
flatMap
Returns a new array formed by applying a given callback function to each element of the array, and then flattening the result by one level.
join
Creates and returns a new string by concatenating all of the elements in an array, separated by commas or a specified separator string.
push
Adds one or more elements to the end of an array and returns the new length of the array.
pop
Removes the last element from an array and returns that element.
shift
Removes the first element from an array and returns that removed element.
unshift
Adds one or more elements to the beginning of an array and returns the new length of the array.
indexOf
Returns the first index at which a given element can be found in the array, or -1 if it is not present.
fill
Fills all the elements of an array from a start index to an end index with a static value.
at
Returns the element at the given index, allowing for positive and negative integers. Negative integers count back from the last element.
split
Divides a String into an ordered list of substrings, puts these substrings into an array, and returns the array.
substring
Returns the part of the string between the start and end indexes, or to the end of the string.
toLowerCase
Returns the calling string value converted to lower case.
toUpperCase
Returns the calling string value converted to upper case.
trim
Removes whitespace from both ends of a string and returns a new string.
replace
Returns a new string with one, some, or all matches of a pattern replaced by a replacement.
replaceAll
Returns a new string with all matches of a pattern replaced by a replacement.
startsWith
Determines whether a string begins with the characters of a specified string.
endsWith
Determines whether a string ends with the characters of a specified string.
padStart
Pads the current string with another string until the resulting string reaches the given length. Padding is applied from the start.
repeat
Constructs and returns a new string which contains the specified number of copies of the string.
charAt
Returns a new string consisting of the single UTF-16 code unit located at the specified offset into the string.
Object.keys
Returns an array of a given object's own enumerable property names, iterated in the same order as a normal loop.
Object.values
Returns an array of a given object's own enumerable property values.
Object.entries
Returns an array of a given object's own enumerable string-keyed property [key, value] pairs.
Object.fromEntries
Transforms a list of key-value pairs into an object.
Object.assign
Copies all enumerable own properties from one or more source objects to a target object. It returns the modified target object.
Object.freeze
Freezes an object. A frozen object can no longer be changed; freezing prevents adding new properties, removing existing properties, and changing values.
hasOwnProperty
Returns a boolean indicating whether the object has the specified property as its own property.
Math.max
Returns the largest of zero or more numbers.
Math.min
Returns the smallest of zero or more numbers.
Math.floor
Returns the largest integer less than or equal to a given number.
Math.ceil
Returns the smallest integer greater than or equal to a given number.
Math.round
Returns the value of a number rounded to the nearest integer.
Math.abs
Returns the absolute value of a number.
Math.random
Returns a floating-point, pseudo-random number in the range 0 to less than 1.
Math.pow
Returns the base to the exponent power.
Math.sqrt
Returns the square root of a number.
JSON.parse
Parses a JSON string, constructing the JavaScript value or object described by the string.
JSON.stringify
Converts a JavaScript value to a JSON string, optionally replacing values if a replacer function is specified.
Promise.all
Takes an iterable of promises and returns a single Promise that resolves when all of the promises resolve, or rejects when any promise rejects.
Promise.allSettled
Returns a promise that resolves after all of the given promises have either fulfilled or rejected, with an array of objects describing the outcome of each promise.
Promise.race
Returns a promise that fulfills or rejects as soon as one of the promises in an iterable fulfills or rejects.
Set.add
Appends a new element with a specified value to the end of a Set object.
Set.has
Returns a boolean indicating whether an element with the specified value exists in a Set object.
Set.delete
Removes a specified value from a Set object, if it is in the set.
Map.set
Adds or updates an entry in the Map object with a specified key and value.
Map.get
Returns a specified element from a Map object.
Map.has
Returns a boolean indicating whether an element with the specified key exists in a Map object.