Implement a function jsonStringify
, similar to JSON.stringify
that converts a JavaScript value into a JSON string.
null
, array, object) will be present in the input value.jsonStringify({ foo: 'bar' }); // '{"foo":"bar"}'jsonStringify({ foo: 'bar', bar: [1, 2, 3] }); // '{"foo":"bar","bar":[1,2,3]}'jsonStringify({ foo: true, bar: false }); // '{"foo":true,"bar":false}'
Other types
jsonStringify(null); // 'null'jsonStringify(true); // 'true'jsonStringify(false); // 'false'jsonStringify(1); // '1'jsonStringify('foo'); // '"foo"'
Implement a function jsonStringify
, similar to JSON.stringify
that converts a JavaScript value into a JSON string.
null
, array, object) will be present in the input value.jsonStringify({ foo: 'bar' }); // '{"foo":"bar"}'jsonStringify({ foo: 'bar', bar: [1, 2, 3] }); // '{"foo":"bar","bar":[1,2,3]}'jsonStringify({ foo: true, bar: false }); // '{"foo":true,"bar":false}'
Other types
jsonStringify(null); // 'null'jsonStringify(true); // 'true'jsonStringify(false); // 'false'jsonStringify(1); // '1'jsonStringify('foo'); // '"foo"'
console.log()
statements will appear here.