Shorthand Javascript code to set all keys in an array to empty ("") strings -
i have array shown in code below. how reset these strings "", without having explicitly refer each key? there way can refer parent object , children = ""?
rmtdata = { firstname : "jane", lastname : "doe", gender : "f", details : "therapist" }; //other code here... //then reset variables here: rmtdata.firstname = ""; rmtdata.lastname = ""; rmtdata.gender = ""; rmtdata.details = "";
for (var key in rmtdata ) rmtdata[key] = "";
and yes, object
Comments
Post a Comment