Skip to main content
Stack Overflow
  1. About
  2. For Teams

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Required fields*

Remove blank attributes from an Object in Javascript

How do I remove all attributes which are undefined or null in a JavaScript object?

(Question is similar to this one for Arrays)

Answer*

Draft saved
Draft discarded
Cancel
2
  • 5
    This is what he is doing above, this also still leaves undefined in the object. Commented Jul 24, 2014 at 15:54
  • 👉️ stackoverflow.com/a/71968391/8621764 check link where you can clear not only null or undefined even you can define your custom value you have to remove 👉️ stackoverflow.com/a/71968391/8621764 Commented Apr 22, 2022 at 12:03

lang-js

AltStyle によって変換されたページ (->オリジナル) /