0% found this document useful (0 votes)
4 views

array_1702327135

The document provides a concise overview of various JavaScript array methods including .every(), .filter(), .find(), .some(), .push(), .pop(), .shift(), .unshift(), .splice(), .concat(), .slice(), and .indexOf(). Each method is explained with its functionality and examples demonstrating how they manipulate arrays. The content is aimed at helping users understand and utilize these array methods effectively in JavaScript programming.

Uploaded by

Kumar Saheb
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

array_1702327135

The document provides a concise overview of various JavaScript array methods including .every(), .filter(), .find(), .some(), .push(), .pop(), .shift(), .unshift(), .splice(), .concat(), .slice(), and .indexOf(). Each method is explained with its functionality and examples demonstrating how they manipulate arrays. The content is aimed at helping users understand and utilize these array methods effectively in JavaScript programming.

Uploaded by

Kumar Saheb
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

uiacademy.in OMKESH B.

KENDRE

ARRAY
YARRA
uiacademy.in OMKESH B. KENDRE

Javascript .every( => === );


every() checks if every element in
the array and return true/false
based on conditions
[ ] true
[ ] false

false
uiacademy.in OMKESH B. KENDRE

Javascript .filter( => === );


filter() creates a new array with
elements that meet a specified
condition, without modifying the
original array.

[ ] [ ]

[ 1, 1 ]
uiacademy.in OMKESH B. KENDRE

Javascript .find( => === );


find() returns the first array
element satisfying a condition.
[ 1 2 3 4 5 ] 2

[ 1 2 3 4 5 ] Undefined

2
uiacademy.in OMKESH B. KENDRE

Javascript .some( => === );


some() checks if at least one
element satisfies a condition.
[ 1 2 3 4 5 ] true

[ 1 2 3 4 5 ] false

true
uiacademy.in OMKESH B. KENDRE

Javascript .push( );
push() adds element(s) to the end
of an array.

[ 1 2 3 4 5 ] [ 1 2 3 4 5 ]

[5, 12, 8, 130, 8, 11]


uiacademy.in OMKESH B. KENDRE

Javascript .pop( );
pop() removes the last element
from the end of an array.

[ 1 2 3 4 5 ] [ 1 2 3 4 5 ]

[ 5, 12, 8, 11, 130 ]


uiacademy.in OMKESH B. KENDRE

Javascript .shift( );
shift() removes the first element
from the beginning of an array.

[ 1 2 3 4 5 ] [ 2 3 4 5 ]

[ 12, 8, 11, 130, 8 ]


uiacademy.in OMKESH B. KENDRE

Javascript .unshift( 1
);
unshift() adds element(s) to the
beginning of an array.

[ 2 3 4 5
] [ 1 2 3 4 5 ]

[ 11, 5, 12, 8, 11, 130, 8 ]


uiacademy.in deleteCount OMKESH B. KENDRE

.splice( 1, 0, 1 ); --> inserting elements


Start item 1, item 2, ... item n

splice() changes the contents of an


array by removing or replacing
elements.
[ 2 3 ] 4 [5 ] 2 1 3 4 5

[5, 12, 8, 11, 130, 8]


uiacademy.in deleteCount OMKESH B. KENDRE

.splice( 1, 1, 1 ); --> Replaces elements


Start item 1, item 2, ... item n

splice() changes the contents of an


array by removing or replacing
elements.
[ 2 3 ] 4 [ 5 ] 2 3 4 5

[5, 12, 11, 130, 8]


uiacademy.in OMKESH B. KENDRE

Javascript [ 2 3 4 ].concat( [ 5 3 ])

concat() merges arrays.

[ 2 3 4 ],[ 5 3 ] [ 2 3 4 5 3
]

[5, 8, 11, 130, 8]


uiacademy.in OMKESH B. KENDRE

Javascript [ 2 3 4 5 3 ].slice( 2 )

slice() forms a new array subset


copy, Original unaffected.
[ 2 3 4 5 3
] [ 4 5 3 ]
shallow copy

[5, 8, 11, 130, 8] [11, 130, 8]


uiacademy.in OMKESH B. KENDRE

Javascript .indexOf( )

indexOf() finds the first


occurrence's index in an array.

[ 2 3 4 5 3 ] 1

2
Like

Did you like Comment

the post?
follow for more! Share

Save

Omkesh B. Kendre
uiacademy.in

You might also like