Created
April 10, 2014 14:45
-
-
Save pmn4/10389909 to your computer and use it in GitHub Desktop.
JSON.stringify takes Parameters
This file contains hidden or 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
| var o = { | |
| a: 1, | |
| b: 2, | |
| c: 3, | |
| d: { | |
| a: 5, | |
| b: 6 | |
| } | |
| }; | |
| console.log("1 Parameter: Render a JSON string"); | |
| console.log(JSON.stringify(o)); | |
| console.log("2 Parameters: Render a JSON string for the given set of keys"); | |
| console.log(JSON.stringify(o, ["a", "b"])); | |
| console.log("3 Parameters: Render a JSON string for the given set of keys, with the given indentation"); | |
| console.log(JSON.stringify(o, ["a", "b"], 4)); // === JSON.stringify(o, ["a", "b"], " "); | |
| // DEBUG THE PLANET! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment