01
DAY
03 THREE
Shivam Raj
www.linkedin.com/in/shivam-raj-979b9822b/
02
push( ) .indexOf( ) reduce( )
pop( ) lastIndexOf( ) forEach( )
shift( ) includes( ) some( )
unshift( ) find( ) every( )
concat( ) .findIndex( ) sort( )
slice( ) filter( ) reverse( )
splice( ) map( ) join( )
Shivam Raj
www.linkedin.com/in/shivam-raj-979b9822b/
03
push( )
The push method in arrays is used to add one or more elements to the end of
an array and returns the new length of the array.
pop( )
The pop method in arrays is used to remove the last element from an array
and return that removed element.
Shivam Raj
www.linkedin.com/in/shivam-raj-979b9822b/
04
shift( )
The shift method in JavaScript is used to remove the first element from an
array and return that removed element.
unshift( )
The unshift method in JavaScript is used to add one or more elements to
the beginning of an array and returns the new length of the array.
Shivam Raj
www.linkedin.com/in/shivam-raj-979b9822b/
05
concat( )
The concat method in JavaScript is used to merge two or more arrays without
modifying the original arrays. It returns a new array.
slice( )
The slice method in JavaScript is used to extract a portion of an array without
modifying the original array. It returns a new array with the selected
elements.
start (optional) – The index where the extraction begins (inclusive).
end (optional) – The index where the extraction stops (exclusive).
(If omitted, it extracts till the end of the array.)
06
splice( )
The splice method in JavaScript is used to add, remove, or replace elements in
an array. It modifies the original array and returns the removed elements.
Remove Elements :
Add Elements :
Replace Element:
Shivam Raj
www.linkedin.com/in/shivam-raj-979b9822b/
07
indexOf( )
The indexOf method in JavaScript is used to find the first occurrence of an
element in an array. It returns the index of the element if found, otherwise, it
returns -1.
lastIndexOf( )
The lastIndexOf method in JavaScript is used to find the last occurrence of an
element in an array. It returns the index of the element if found; otherwise, it
returns -1.
Shivam Raj
www.linkedin.com/in/shivam-raj-979b9822b/
08
includes( )
The includes method in JavaScript is used to check if an array contains a
specific element. It returns true if the element is found, otherwise false.
lastIndexOf( )
The lastIndexOf method in JavaScript is used to find the last occurrence of an
element in an array. It returns the index of the element if found; otherwise, it
returns -1.
Shivam Raj
www.linkedin.com/in/shivam-raj-979b9822b/
09
find( )
The find method is used to retrieve the first element in an array that meets a
condition specified in a callback function.
callback – A function that runs on each element.
element – The current element being processed.
index (optional) – The index of the current element.
array (optional) – The array find is being applied to.
thisArg (optional) – Value to use as this in the callback.
Shivam Raj
www.linkedin.com/in/shivam-raj-979b9822b/
10
findIndex( )
The findIndex method in JavaScript is used to find the index of the first
element in an array that satisfies a given condition. If no element matches, it
returns -1.
callback – A function that tests each element.
element – The current element being processed.
index (optional) – The index of the current element.
array (optional) – The array being searched.
thisArg (optional) – Value to use as this in the callback.
Shivam Raj
www.linkedin.com/in/shivam-raj-979b9822b/
11
findIndex( )
The findIndex method in JavaScript is used to find the index of the first
element in an array that satisfies a given condition. If no element matches, it
returns -1.
callback – A function that tests each element.
element – The current element being processed.
index (optional) – The index of the current element.
array (optional) – The array being searched.
thisArg (optional) – Value to use as this in the callback.
Shivam Raj
www.linkedin.com/in/shivam-raj-979b9822b/
12
fliter()
The filter method in JavaScript is used to create a new array with elements that
meet a specific condition. It does not modify the original array.
callback – A function that tests each element.
element – The current element being processed.
index (optional) – The index of the current element.
array (optional) – The array being filtered.
thisArg (optional) – Value to use as this in the callback.
Shivam Raj
www.linkedin.com/in/shivam-raj-979b9822b/
13
map()
The map method in JavaScript is used to create a new array by transforming
each element of the original array. It does not modify the original array.
callback – A function applied to each element.
element – The current element being processed.
index (optional) – The index of the current element.
array (optional) – The original array.
thisArg (optional) – Value to use as this in the callback.
Shivam Raj
www.linkedin.com/in/shivam-raj-979b9822b/
14
reduce( )
The reduce method in JavaScript is used to accumulate values from an array
into a single result. It processes each element and carries forward an
accumulated value.
callback – A function executed for each element.
accumulator – The accumulated value (previous result).
element – The current element being processed.
index (optional) – The index of the current element.
array (optional) – The original array.
initialValue (optional) – The starting value of the accumulator.
Shivam Raj
www.linkedin.com/in/shivam-raj-979b9822b/
15
reduce( )
The reduce method in JavaScript is used to accumulate values from an array
into a single result. It processes each element and carries forward an
accumulated value.
callback – A function executed for each element.
accumulator – The accumulated value (previous result).
element – The current element being processed.
index (optional) – The index of the current element.
array (optional) – The original array.
initialValue (optional) – The starting value of the accumulator.
Shivam Raj
www.linkedin.com/in/shivam-raj-979b9822b/
16
foreach()
The forEach method in JavaScript is used to iterate over each element in an
array and execute a function for each element. It does not return a new array
and does not modify the original array unless explicitly done inside the
function.
callback – A function executed for each element.
element – The current element being processed.
index (optional) – The index of the current element.
array (optional) – The original array.
thisArg (optional) – Value to use as this in the callback.
Shivam Raj
www.linkedin.com/in/shivam-raj-979b9822b/
17
sort( )
The sort method in JavaScript is used to sort elements of an array in place. By
default, it sorts elements as strings in ascending order, which can cause
unexpected results when sorting numbers.
reverse( )
The reverse method in JavaScript is used to reverse the order of elements in
an array. It modifies the original array in place and does not return a new one.
Shivam Raj
www.linkedin.com/in/shivam-raj-979b9822b/
18
join( )
The join method in JavaScript converts an array into a string, with elements
separated by a specified delimiter.
some()
The some method in JavaScript is used to check if at least one element in an
array satisfies a given condition. It returns true or false.
Shivam Raj
www.linkedin.com/in/shivam-raj-979b9822b/