Skip to content

Instantly share code, notes, and snippets.

@miguelmota
Last active March 20, 2020 10:10
Show Gist options
  • Save miguelmota/300445a06a342e47a335 to your computer and use it in GitHub Desktop.
Save miguelmota/300445a06a342e47a335 to your computer and use it in GitHub Desktop.
Deep clone copy array with lodash (underscore)
var array = [{},{},{}];
var copy = _.map(array, _.clone);
Copy link

ghost commented Mar 11, 2019

var array = [{},{},{}];
var copy = array.slice();

It's easy and not change array

This won't work.

@turkoz
Copy link

turkoz commented May 15, 2019

Beautiful touch!..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment