Example 1 — Official: Shallow Array Clone
New array shell; element objects stay shared.
var objects = [{ a: 1 }, { b: 2 }];
var shallow = _.clone(objects);
console.log(shallow[0] === objects[0]);
// → true
console.log(shallow === objects);
// → false How It Works
- Clone. Lodash builds a new array.
- Elements. Each slot still points at the original object.
- Identity.
shallow[0] === objects[0]istrue. - Shell.
shallow === objectsisfalse.

