I've noticed that deleting object properties when using Array.map() affects the original array, I assume since each iteration's item is still referencing the original array:
var objects = [{name: 'a', password: 'x'}, {name: 'b', password: 'x'}];
var clean = objects.map(user => {delete user.password; return user;});
console.log(JSON.stringify(objects));
> [{"name":"a"},{"name":"b"}]
Is there a way to use map or filter without it modifying the original? I can think to loop through each item and create a clone but curious if there's a simpler way.