JS Built-ins
JSONstringifybeginner

JSON.stringify() β€” pretty print with space

πŸ“– Usage Example
JSON.stringify({ a: 1, b: undefined })  // β†’ '{"a":1}'

JSON.stringify() omits object properties with undefined values.

JSON.stringify with Space

JSON.stringify(value, null, 2) pretty-prints with indentation, adding newlines.

Challenge: Verify the result contains a newline character.

πŸ’‘ Hints (1)
  • β€’ The third argument to JSON.stringify sets indentation.