Page cover

Home

Github Repo: https://github.com/bgoonz/Array-Methods-Lesson

map([๐ŸŒฝ, ๐Ÿฎ, ๐Ÿ”], cook) => [๐Ÿฟ, ๐Ÿ”, ๐Ÿณ]

filter([๐Ÿฟ, ๐Ÿ”, ๐Ÿณ], isVegetarian) => [๐Ÿฟ, ๐Ÿณ]

reduce([๐Ÿฟ, ๐Ÿณ], eat) => ๐Ÿ’ฉ

DOWNLOAD JS FILES FOR LESSON:

6KB
Open
download-js-files
Public Web Address
Corresponding Github Repository

map([๐ŸŒฝ, ๐Ÿฎ, ๐Ÿ”], cook) => [๐Ÿฟ, ๐Ÿ”, ๐Ÿณ]

filter([๐Ÿฟ, ๐Ÿ”, ๐Ÿณ], isVegetarian) => [๐Ÿฟ, ๐Ÿณ]

reduce([๐Ÿฟ, ๐Ÿณ], eat) => ๐Ÿ’ฉ

Table of contents

Methods

๐Ÿ‘จ๐Ÿ’ป Methods

Aux Information

Background

๐Ÿ“– Resources

๐Ÿ‘ฝ Miscellaneous

Cheat sheet: Arrays

JavaScript Arrays are a very flexible data structure and used as lists, stacks, queues, tuples (e.g. pairs), etc. Some

Using Arrays

Creating Arrays, reading and writing elements:

The lengths of Arrays, adding elements:

Concatenating Arrays via spreading (...):

Clearing Arrays (removing all elements):

Looping over elements:

Looping over key-element pairs:

Creating and filling Arrays when we canโ€™t use Array literals (e.g. because we donโ€™t know their lengths in advance or they are too large):

Array methods

Deriving a new Array from an existing Array:

Removing an Array element at a given index:

Computing a summary of an Array:

Changing all of an Array (the input Array is modified and returned):

Finding Array elements:

Listing elements (Array.from() is needed because the methods return iterables, not Arrays):

Adding or removing an element at either end of an Array:

Last updated

Was this helpful?