I need to keep the overall layout of an object. I pass it into a method and:
- I need to delete things from the object, then do something,
- once I get back to the main function I was in
- I need the object to be UNTOUCHED.
The way it is setup now it deletes it from the main object as well as the one in the bottom method. SEE JSFiddle for code http://jsfiddle.net/rwux4rta/ To get the results from the run, see console
Please HELP!
$( document ).ready(function() {
var pList = new Object();
pList["test"] = "test"; //this is being deleted from BOTH instances of the Obj
pList["test1"] = "test1";
pList["test2"] = "test2";
pList["test3"] = "test3";
pList["test4"] = "test4";
displayData(pList);
console.log(pList);
});
function displayData(badData){
badData.test.removeData();
console.log(badData);
}