TypeScript ArrayFuncitons


1.Arrays

1)some()-Return Boolean checks condition on array,any one element satisfies return True

                                        (opposite)

every()-Return Boolean checks condition on array,every element satisfies return True


2)push()-Adds one or more elements to the end of an array and returns the new length of the array.

                                        (opposite)

unshift()-Adds one or more elements to the front of an array and returns the new length of the array.


3)pop()-Removes the last element from an array and returns that element.

(opposite)

shift()-Removes the first element from an array and returns that element.


splice(index,1)-Removes an elements from array of particular index


4)filter()-Return new array based on filter condition


5)map()-Return a array ,It is like a for loop we can transform/perform operation on every element in  array


6)join()-Joins all elements of an array into a string.


6)forEach()--arr.forEach()


7)sort((a,b))


8)reverse()-Reverses the order of the elements of an array -- the first becomes the last, and the last becomes the first.


9)toString()-Returns a string representing the array and its elements.


10)reduce()


11)include()

Comments