How to Copy an Array in JavaScript with Array.from()
Copying an array in JavaScript is easy with Array.from()
, but it is a shallow copy — nested arrays and objects are vulnerable to bugs.
Published in
5 min readFeb 26, 2020
The simplest way to copy a JavaScript array
“The
Array.from()
method creates a new…