Skip to content

Glossary: Algorithms Beyond the Basics in JavaScript

Copy (of an array)

Also written: copy, slice(), chosen.slice()

A new array with the same items, made with `slice()`, so later changes to the original don't touch it. Backtracking saves `chosen.slice()` at the base case, because otherwise every saved answer would be the same array that keeps being emptied.

Where the book teaches it

Related terms

Backtracking