I need to set all properties of some object to null. But the object can be very big, so I can\'t just do it one by one.
null
How to set all properties at onc
You can use Object.keys() as Nianyi Wang mentioned in his answer, or a for in, like this:
Object.keys()
for in
for (key in obj) { if (obj.hasOwnProperty(key)) { obj[key] = null; } }
But in this case you should check hasOwnProperty().
hasOwnProperty()