How to remove all getters and setters from an object in Javascript and keep pure value
问题 I'm using a library called which takes a JS object as an input. Unfortunately, the JSONP api that I am using returns an object containing getters and setters, which this particular library does not know how to handle. How can I remove all getters and setters from an object while retaining the values of the properties, so I have a Plain Old JavaScript Object? 回答1: a solution for this special case/environment/setting might look like that ... var obj = JSON.parse(JSON.stringify(model)); console