I have a result set which is an array of objects. I need to clone this so I can make changes to it, without touching the original data.
var data = w2ui.grid.
Lodash has a method specifically for this called clonedeep. There's a standalone package for it if you don't want to pull in the entire library:
clonedeep
https://www.npmjs.com/package/lodash.clonedeep