0% found this document useful (0 votes)
3 views2 pages

JS Array Methods CheatSheet

This cheat sheet provides an overview of JavaScript array methods, categorizing them into callback-based methods and non-callback methods. It lists various methods along with their functionalities, such as forEach, map, and filter for callbacks, and push, pop, and slice for non-callbacks. A summary table highlights features like whether methods use callbacks, return new arrays, or mutate the original array.

Uploaded by

ekansh kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

JS Array Methods CheatSheet

This cheat sheet provides an overview of JavaScript array methods, categorizing them into callback-based methods and non-callback methods. It lists various methods along with their functionalities, such as forEach, map, and filter for callbacks, and push, pop, and slice for non-callbacks. A summary table highlights features like whether methods use callbacks, return new arrays, or mutate the original array.

Uploaded by

ekansh kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

JavaScript Array Methods - Cheat Sheet

1. Callback-Based Methods

Methods that Accept Callback:

- forEach(): Runs a function on each element (no return).

- map(): Returns a new array after applying a function to each element.

- filter(): Returns elements that pass a test.

- find(): Returns the first element that passes a test.

- findIndex(): Returns index of first element that passes a test.

- some(): Returns true if at least one element passes a test.

- every(): Returns true if all elements pass a test.

- reduce(): Reduces array to a single value (left-to-right).

- reduceRight(): Like reduce, but right-to-left.

- flatMap(): Maps and flattens array one level.

- sort(): Sorts array (can use custom comparator).

2. Non-Callback Methods

Methods that Do Not Accept Callback:

- push(), pop(), shift(), unshift(), splice(): Modify array content.

- slice(), concat(), flat(): Return a new array (non-mutating).

- reverse(), fill(), copyWithin(): Modify original array.

- join(), toString(), includes(), indexOf(), lastIndexOf(), at(): Do not mutate.

3. Quick Summary

Summary Table:

Feature | Methods

------------------|----------------------------------------------------------

Page 1 - Generated on 2025-05-13


JavaScript Array Methods - Cheat Sheet

Uses callback | forEach, map, filter, find, reduce, etc.

No callback | push, pop, splice, slice, flat, at, join, etc.

Returns new array | map, filter, slice, flat, concat, flatMap

Mutates array | push, pop, splice, sort, reverse, fill, etc.

Page 2 - Generated on 2025-05-13

You might also like