Stew.copy() - shysolocup/stews GitHub Wiki
creates a separate copy of the stew
type: Function
alt names:
- clone()
list: | pair: |
const { Stew } = require('stews');
let arr = new Stew([ "a", "c" ]);
let copy = arry.copy();
arr[1] = "b";
console.log(arr);
console.log(copy); |
const { Stew } = require('stews');
let obj = new Stew({ key1: "val1", key2: "val3" });
let copy = obj.copy();
obj[1] = "val2";
console.log(obj);
console.log(copy); |
Stew(2) [ "a", "b" ] // original
Stew(2) [ "a", "c" ] // copy |
Stew(2) { key1: "val1", key2: "val2" } // original
Stew(2) { key1: "val1", key2: "val3" } // copy |