JSFiddle - React, Tailwind, and code Playground
HTML
<input text='test' type='button' />
JavaScript
$('input').click(function() {
myTest();
});
function myTest() {
var pList = new Object();
pList["test"] = "test";
pList["test1"] = "test1";
pList["test2"] = "test2";
pList["test3"] = "test3";
pList["test4"] = "test4";
displayData(pList);
console.log(pList);
}
function displayData(badData){
var newBadData = clone(badData);
delete newBadData.test;
console.log(newBadData);
}
//source http://stackoverflow.com/a/728694/1143670
function clone(obj) {
if (null == obj || "object" != typeof obj) return obj;
var copy = obj.constructor();
for (var attr in obj) {
if (obj.hasOwnProperty(attr)) copy[attr] = obj[attr];
}
return copy;
}