Does JSON.stringify
work with objects that are created like
obj = {}
Object.defineProperty(obj, 'prop', {
get: function() { return 1 }
set: function(value) { ... }
})
It returns {}
when called on this object.
You might want to set the enumerable option to true, like this:
Object.defineProperty(o, 'test', {
get: function () { return 1; },
enumerable: true
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.