JS Built-ins
JSONstringifybeginner

JSON.stringify() β€” string

πŸ“– Usage Example
JSON.stringify({ a: 1 }, null, 2)  // pretty-prints with 2-space indent

Pass a space argument to JSON.stringify() to produce human-readable output.

JSON.stringify String

JSON.stringify('hello') returns '"hello"' β€” a string wrapped in double quotes.

Challenge: Stringify a string and verify the result.

πŸ’‘ Hints (1)
  • β€’ Strings are wrapped in double quotes in JSON output.