Skip to content

Glossary: JavaScript Beyond the Basics

Non-mutating array methods

Also written: toSorted, toReversed, with, flatMap

`toSorted`, `toReversed` and `with(index, value)` return a new array and leave the original alone, unlike `sort` and `reverse`, which change it in place. `flatMap` maps each item to an array and joins the results.

Where the book teaches it

Related terms

Map / Set