Implement a function jsonStringify(value) that converts a JavaScript value into a JSON string.
Only the following types will appear in input: boolean, number, null, string, array, or object.
Requirements:
Examples
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}' jsonStringify(null); // 'null' jsonStringify(true); // 'true' jsonStringify(false); // 'false' jsonStringify(1); // '1' jsonStringify('foo'); // '"foo"'
JavaScript Function
No test results yet
Click "Run" to execute tests