Converts the given parameter into the string equivalent.
If the thing provided has the type of "object", then this function returns JSON.stringify(thing). Otherwise, it will wrap the thing in a String and convert it to it's string representation.
JSON.stringify(thing)
thing
stringify({ foo: "bar" }); // "{ "foo": "bar" }"stringify([1, 2, 3]); // "[1, 2, 3]"stringify(1); // "1" Copy
stringify({ foo: "bar" }); // "{ "foo": "bar" }"stringify([1, 2, 3]); // "[1, 2, 3]"stringify(1); // "1"
Converts the given parameter into the string equivalent.
If the thing provided has the type of "object", then this function returns
JSON.stringify(thing)
. Otherwise, it will wrap thething
in a String and convert it to it's string representation.