Created
May 20, 2015 19:51
-
-
Save danielmconrad/085dc402dc4b186a8641 to your computer and use it in GitHub Desktop.
Challenge: myJSON.stringify
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
//Q. Create an object, myJSON, with one function, `stringify` that will take one parameter and stringify it like `JSON.stringify` does. | |
//Object types can be: | |
// Object | |
// Array | |
// Number | |
// String | |
// Boolean | |
var myJSON, thingToStringify; | |
myJSON.stringify = function(input){ | |
// Your code goes here | |
}; | |
//thingToStringify = 1; | |
//thingToStringify = ‘one’; | |
//thingToStringify = ‘1’; | |
//thingToStringify = [1]; | |
//thingToStringify = {one: 1}; | |
//thingToStringify = {one: ‘1’}; | |
//thingToStringify = {one: [‘one’]}; | |
//thingToStringify = {one: {won: 1}}; | |
output = myJSON.stringify(thingToStringify); | |
console.log(output); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment