1. Array Methods:
-
array.length
: Returns the number of elements in the array. -
array.push(element)
: Adds one or more elements to the end of an array and returns the new length of the array. -
array.pop()
: Removes the last element from an array and returns that element. -
array.shift()
: Removes the first element from an array and returns it. -
array.unshift(element)
: Adds one or more elements to the beginning of an array and returns the new length of the array. -
array.slice(start, end)
: Returns a shallow copy of a portion of an array into a new array. -
array.splice(start, deleteCount, item1, item2, ...)
: Adds/removes items to/from an array, starting at the given index. -
array.indexOf(element)
: Returns the first index at which a given element can be found in the array, or-1
if it is not present. -
array.includes(element)
: Determines whether an array contains a certain element, returningtrue
orfalse
. -
array.sort()
: Sorts the elements of an array in place and returns the sorted array. -
array.reverse()
: Reverses the order of the elements in an array. -
array.forEach(callback)
: Executes a provided function once for each array element. -
array.map(callback)
: Creates a new array populated with the results of calling a function for every array element. -
array.filter(callback)
: Creates a new array with all elements that pass the test implemented by the provided function. -
array.reduce(callback, initialValue)
: Applies a function against an accumulator and each element in the array to reduce it to a single value. -
array.find(callback)
: Returns the first element in the array that satisfies the provided testing function. -
array.findIndex(callback)
: Returns the index of the first element in the array that satisfies the provided testing function. -
array.every(callback)
: Tests whether all elements in the array pass the provided function test. -
array.some(callback)
: Tests whether at least one element in the array passes the provided function test. -
array.concat(array2)
: Merges two or more arrays and returns a new array. -
array.join(separator)
: Joins all elements of an array into a string.
2. String Methods:
-
string.length
: Returns the length of a string. -
string.toUpperCase()
: Converts the string to uppercase. -
string.toLowerCase()
: Converts the string to lowercase. -
string.charAt(index)
: Returns the character at the specified index. -
string.indexOf(substring)
: Returns the index of the first occurrence of the specified substring, or-1
if not found. -
string.lastIndexOf(substring)
: Returns the index of the last occurrence of the specified substring. -
string.includes(substring)
: Determines whether a string contains another string, returningtrue
orfalse
. -
string.slice(start, end)
: Extracts a section of a string and returns it as a new string. -
string.split(separator)
: Splits a string into an array of substrings based on a specified separator. -
string.trim()
: Removes whitespace from both ends of a string. -
string.replace(searchValue, newValue)
: Replaces a substring or pattern in the string with a new value. -
string.startsWith(substring)
: Checks if the string starts with the specified substring. -
string.endsWith(substring)
: Checks if the string ends with the specified substring. -
string.repeat(count)
: Returns a new string with the original string repeatedcount
times.
3. Object Methods:
-
Object.keys(obj)
: Returns an array of a given object's own property names. -
Object.values(obj)
: Returns an array of a given object's own enumerable property values. -
Object.entries(obj)
: Returns an array of a given object's own enumerable key-value pairs. -
Object.assign(target, source)
: Copies all enumerable properties from one or more source objects to a target object. -
Object.freeze(obj)
: Freezes an object, making it immutable. -
Object.seal(obj)
: Seals an object, preventing new properties from being added but allowing modification of existing properties. -
Object.hasOwnProperty(property)
: Returnstrue
if the object has the specified property as its own property.
4. Number Methods:
-
Number.isNaN(value)
: Determines whether the value isNaN
(Not-a-Number). -
Number.isInteger(value)
: Determines whether the value is an integer. -
Number.parseFloat(string)
: Converts a string to a floating-point number. -
Number.parseInt(string)
: Converts a string to an integer. -
number.toFixed(digits)
: Formats a number using fixed-point notation. -
number.toString(base)
: Converts a number to a string, optionally using a specified base (radix).
5. Math Methods:
-
Math.round(value)
: Rounds a number to the nearest integer. -
Math.floor(value)
: Rounds a number down to the nearest integer. -
Math.ceil(value)
: Rounds a number up to the nearest integer. -
Math.max(...values)
: Returns the largest of zero or more numbers. -
Math.min(...values)
: Returns the smallest of zero or more numbers. -
Math.random()
: Returns a pseudo-random number between 0 and 1. -
Math.abs(value)
: Returns the absolute value of a number. -
Math.sqrt(value)
: Returns the square root of a number. -
Math.pow(base, exponent)
: Returns the base to the exponent power (base^exponent).
6. Date Methods:
-
new Date()
: Creates a new date object with the current date and time. -
Date.now()
: Returns the number of milliseconds since January 1, 1970. -
date.getFullYear()
: Returns the year of the specified date. -
date.getMonth()
: Returns the month (0-11) of the specified date. -
date.getDate()
: Returns the day of the month (1-31). -
date.getDay()
: Returns the day of the week (0-6). -
date.getHours()
: Returns the hour (0-23). -
date.getMinutes()
: Returns the minutes (0-59). -
date.getSeconds()
: Returns the seconds (0-59). -
date.getMilliseconds()
: Returns the milliseconds (0-999).
7. Control Flow Functions:
-
setTimeout(callback, delay)
: Executes the callback function after the specified delay (in milliseconds). -
setInterval(callback, delay)
: Repeatedly executes the callback function after the specified delay (in milliseconds). -
clearTimeout(id)
: Cancels a timeout previously established bysetTimeout()
. -
clearInterval(id)
: Cancels a repeated action set bysetInterval()
.
8. Promise Methods:
-
Promise.all(iterable)
: Waits for all promises in the iterable to resolve or for any to reject. -
Promise.race(iterable)
: Waits for the first promise to resolve or reject. -
Promise.resolve(value)
: Returns a promise that is resolved with the given value. -
Promise.reject(reason)
: Returns a promise that is rejected with the given reason.
9. JSON Methods:
-
JSON.stringify(object)
: Converts a JavaScript object to a JSON string. -
JSON.parse(string)
: Parses a JSON string and returns a JavaScript object.
Top comments (0)