I create an object thus:
var savingArray = new Array({doctorId: "something", username: "something", password: "something", givenName: "something", familyName: "something", address: "something", zip:"something", emailAddress: "something", phoneNumber: "something", labs: "something", defaultLab: "something"});
Now i wish to remove every value of objects…I would like to end up with savingArray such that:
savingArray == ({doctorId: "", username: "", password: "", givenName: "", familyName: "", address: "", zip:"", emailAddress: "", phoneNumber: "", labs: {}, defaultLab: ""});
So all i want is to change all values to “” dinamicaly..
savingArray has never the same object so a can’t do like this:
savingArray[0].doctorId = "";
Or since you are using jQuery you an also use its
$.each()function to iterate:In case something modified
Object.prototype(e.g. added methods to it – something that usually shouldn’t be done) you’d need to add anif(obj.hasOwnProperty(key))check and only set the value if that check succeeds.