- Use the
map()
method to apply a function to each element in an array and create a new array with the results. - Use the
reduce()
method to iterate over an array and create a single value from the elements. - Use the
filter()
method to create a new array with only the elements that pass a certain condition. - Use the
sort()
method to sort the elements in an array in ascending or descending order. - Use the
includes()
method to check if a given element is present in an array. - Use the
find()
method to find the first element in an array that matches a certain condition. - Use the
findIndex()
method to find the index of the first element in an array that matches a certain condition. - Use the
Object.keys()
method to get an array of the keys in an object. - Use the
Object.values()
method to get an array of the values in an object. - Use the
Object.entries()
method to get an array of key-value pairs in an object. - Use the
split()
method to split a string into an array of substrings based on a given separator. - Use the
join()
method to combine the elements of an array into a single string, separated by a specified separator. - Use the
toUpperCase()
andtoLowerCase()
methods to convert the case of a string. - Use the
trim()
method to remove leading and trailing whitespace from a string. - Use the
substr()
method to extract a specified number of characters from a string, starting at a given index. - Use the
substring()
method to extract a substring from a string, between two specified indices. - Use the
replace()
method to replace one or more substrings in a string with a specified replacement. - Use the
indexOf()
method to find the index of the first occurrence of a given substring in a string. - Use the
lastIndexOf()
method to find the index of the last occurrence of a given substring in a string. - Use the
search()
method to find the position of a regular expression match in a string. - Use the
match()
method to find all matches of a regular expression in a string and return them as an array. - Use the
concat()
method to combine two or more arrays into a single array. - Use the
slice()
method to extract a portion of an array and create a new array with the extracted elements. - Use the
splice()
method to add or remove elements from an array at a specified index. - Use the
reverse()
method to reverse the order of the elements in an array. - Use the
push()
method to add one or more elements to the end of an array. - Use the
pop()
method to remove the last element from an array and return it. - Use the
unshift()
method to add one or more elements to the beginning of an array. - Use the
shift()
method to remove the first element from an array and return it. - Use the
Math.max()
andMath.min()
methods to find the maximum and minimum values in an array.
Note: This article is actually written by chatGPT (https://chat.openai.com/chat)🤩
Top comments (0)