Array Methods...
1. values() 16. concat() 31. isArray()
2. length() 17. some() 32. filter()
3. reverse() 18. splice() 33. keys()
4. sort() 19. flat() 34. map()
5. at() 20. lastIndexOf()
6. fill() 21. of()
7. from() 22. every()
8. join() 23. slice()
9. toString() 24. flatMap()
10. pop() 25. findIndex()
11. forEach() 26. find()
12. shift() 27. inculdes()
13. copyWithin() 28. entries()
14. push() 29. reduceRight()
15. unshift() 30. reduce()
values(): This method returns an iterator
that provides the values for each index in
the array. It takes no arguments.
length(): This property returns the length of
the array.
reverse(): This method reverses the order of
the elements in the array.
sort(): This method sorts the elements of an
array in place and returns the sorted array.
It can take an optional compare function as
an argument.
at(): This method returns the element at the
specified index in the array. It takes one
argument: the index.
fill(): This method fills all the elements of an
array from a start index to an end index with a
static value. It can take up to three arguments:
the value to fill with, the start index, and the
end index.
from(): This method creates a new array from
an array-like object or an iterable object. It can
take up to two arguments: the object to convert
to an array, and a mapping function to apply to
each element of the new array.
join(): This method joins all the elements of an
array into a string using a specified separator.
It takes one optional argument: the separator
to use.
toString(): This method returns a string
representing the array and its elements.
pop(): This method removes the last element
from an array and returns that element.
forEach() method executes a provided function
once for each array element. It doesn't return
anything, it just executes the callback function
on each element of the array.
shift() method removes the first element from
an array and returns that removed element.
This method changes the length of the array.
copyWithin() method shallow copies part of an
array to another location in the same array and
returns the modified array without modifying
its length.Syntax .copyWithin(target, start, end)
push() method adds one or more elements to
the end of an array and returns the new length
of the array.
unshift() method adds one or more elements to
the beginning of an array and returns the new
length of the array.
concat() method is used to merge two or more
arrays. This method does not change the
existing arrays, but instead returns a new array.
splice() method changes the contents of an
array by removing or replacing existing
elements and/or adding new elements in place.
flat() This method creates a new array with all
sub-array elements concatenated into it
recursively up to the specified depth.
lastIndexOf() This method returns the last
index at which a given element can be found in
the array.
indexOf(): This method returns the index of the
first occurrence of a specified element in an
array. If the element is not present, it returns
-1.
of(): This method creates a new array instance
with a variable number of arguments,
regardless of number or type of the arguments.
every(): This method checks if all elements in
an array pass a test (provided as a function). It
returns true if all elements pass the test;
otherwise, it returns false.
slice(): This method returns a shallow copy of a
portion of an array into a new array object
selected from begin to end (end not included).
flatMap(): This method maps each element
using a mapping function, then flattens the
result into a new array.
findIndex(): This method returns the index of
the first element in an array that passes a test
(provided as a function). If no element passes
the test, it returns -1.
find(): This method returns the value of the
first element in an array that passes a test
(provided as a function). If no element passes
the test, it returns undefined.
includes(): This method determines whether an
array includes a certain value among its entries,
returning true or false as appropriate.
entries(): This method returns a new Array
Iterator object that contains the key/value
pairs for each index in the array.
reduce(): This method applies a function to
each element of an array and reduces the array
to a single value.
reduceRight(): This method is similar to the
reduce() method. However, it iterates over the
array elements from right to left instead of
from left to right.
isArray(): This method determines whether the
passed value is an array or not.
filter(): This method creates a new array with
all elements that pass the test implemented by
the provided function.
keys(): This method returns an array containing
the keys of the given object.
map(): This method creates a new array with
the results of calling a provided function on
every element in the calling array.
Like
Share
Follow
Shahroz Khalid Save for Later