JavaScript Reference

Complete guide to JavaScript methods and properties

📚 Array (25)

map()

Creates a new array with the results of calling a provided function on every element in the calling array.

ES5+

filter()

Creates a new array with all elements that pass the test implemented by the provided function.

ES5+

reduce()

Executes a reducer function on each element of the array, resulting in a single output value.

ES5+

forEach()

Executes a provided function once for each array element.

ES5+

find()

Returns the first element in the array that satisfies the provided testing function.

ES6+

findIndex()

Returns the index of the first element in the array that satisfies the provided testing function.

ES6+

some()

Tests whether at least one element in the array passes the test implemented by the provided function.

ES5+

every()

Tests whether all elements in the array pass the test implemented by the provided function.

ES5+

includes()

Determines whether an array includes a certain value among its entries.

ES7+

indexOf()

Returns the first index at which a given element can be found in the array.

ES5+

slice()

Returns a shallow copy of a portion of an array into a new array object.

ES3+

splice()

Changes the contents of an array by removing or replacing existing elements and/or adding new elements.

ES3+

concat()

Merges two or more arrays into a new array.

ES3+

join()

Creates and returns a new string by concatenating all elements in an array.

ES3+

reverse()

Reverses an array in place and returns the reference to the same array.

ES3+

sort()

Sorts the elements of an array in place and returns the sorted array.

ES3+

push()

Adds one or more elements to the end of an array and returns the new length.

ES3+

pop()

Removes the last element from an array and returns that element.

ES3+

shift()

Removes the first element from an array and returns that element.

ES3+

unshift()

Adds one or more elements to the beginning of an array and returns the new length.

ES3+

flat()

Creates a new array with all sub-array elements concatenated into it recursively up to the specified depth.

ES2019+

flatMap()

Returns a new array formed by applying a given callback function to each element of the array, then flattening the result by one level.

ES2019+

fill()

Fills all the elements of an array from a start index to an end index with a static value.

ES6+

Array.from()

Creates a new Array instance from an array-like or iterable object.

ES6+

Array.isArray()

Determines whether the passed value is an Array.

ES5+

📝 String (22)

split()

Divides a string into an ordered list of substrings and returns them as an array.

ES3+

slice()

Extracts a section of a string and returns it as a new string.

ES3+

substring()

Returns the part of the string between the start and end indexes.

ES3+

toLowerCase()

Returns the string converted to lower case.

ES3+

toUpperCase()

Returns the string converted to upper case.

ES3+

trim()

Removes whitespace from both ends of a string.

ES5+

trimStart()

Removes whitespace from the beginning of a string.

ES2019+

trimEnd()

Removes whitespace from the end of a string.

ES2019+

replace()

Returns a new string with some or all matches of a pattern replaced by a replacement.

ES3+

replaceAll()

Returns a new string with all matches of a pattern replaced by a replacement.

ES2021+

includes()

Determines whether one string may be found within another string.

ES6+

startsWith()

Determines whether a string begins with the characters of a specified string.

ES6+

endsWith()

Determines whether a string ends with the characters of a specified string.

ES6+

indexOf()

Returns the index of the first occurrence of a specified value in a string.

ES3+

charAt()

Returns the character at the specified index in a string.

ES3+

charCodeAt()

Returns the UTF-16 code unit at the specified index.

ES3+

concat()

Concatenates the string arguments to the calling string.

ES3+

repeat()

Returns a new string with a specified number of copies of the string.

ES6+

padStart()

Pads the current string from the start with another string until the resulting string reaches the given length.

ES2017+

padEnd()

Pads the current string from the end with another string until the resulting string reaches the given length.

ES2017+

match()

Retrieves the result of matching a string against a regular expression.

ES3+

search()

Executes a search for a match between a regular expression and this string.

ES3+