An easier way to shallow copy an array is to simply call `slice`: `obj[i] = sw[1].slice();`