Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aarsilv/6889534 to your computer and use it in GitHub Desktop.
Save aarsilv/6889534 to your computer and use it in GitHub Desktop.
Simple example showing how JSON.stringify() of an object excludes properties of undefined objects.
arr = ['a','b']
//[ 'a', 'b' ]
obj = {a: arr[0], b: arr[1], c: arr[2]}
//{ a: 'a', b: 'b', c: undefined }
JSON.stringify(obj)
//'{"a":"a","b":"b"}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment