JSFiddle - React, Tailwind, and code Playground

by Alex Baumgertner

JavaScript

var mutateObject = { name: 'Alex' };

var testArray = [mutateObject];
var testArrayMutableCopy = testArray.slice();

console.log(testArrayMutableCopy);

testArrayMutableCopy[0].name = 'Dan';

console.log(mutateObject);