I have an object that has some properties and methods, like so:
{name: "FirstName",
age: "19",
load: function () {},
uniq: 0.5233059714082628}
and I have to pass this object to another function. So I tried to use JSON.stringify(obj) but the load function (which of course isn't empty, this is just for the purpose of this example) is being "lost".
Is there any way to stringify
and object and maintain the methods it has?
Thanks!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…