Loading problem…
Implement a simplified version of JSON.stringify that converts JavaScript values to JSON strings.
Given a JavaScript value, convert it to a JSON string representation. Your implementation should handle:
stringify(42); // "42"
stringify("hello"); // '"hello"'
stringify(true); // "true"
stringify(null); // "null"
stringify([1, 2, 3]); // "[1,2,3]"
stringify({a: 1, b: 2}); // '{"a":1,"b":2}'This problem models real JSON serialization: