Created
October 8, 2013 18:44
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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