In the Javascript console, the following:
var a = {'foo': []}; var b = {}; for (var key in a) { b[key] = a[key]; } a['foo'].push(1); console.log(b);
Productivity:
Object foo=[1]
I want to make a copy by the value in b of each array for each key in a. Is there an easier way?
javascript deep-copy
Wells
source share