JSON.stringify function
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: 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! 回答1: Why exactly do you want to stringify the object? JSON doesn't understand functions (and it's not supposed to).