Question · JavaScript and TypeScript course · Module 4: Asynchronous JavaScript

JSON.stringify() - replacer and space

What does the third argument in JSON.stringify(obj, null, 2) do?

Answer options

  • Sets the number of spaces for formatting (pretty print)
  • Specifies the character encoding
  • Sets the size limit of the resulting string
  • Specifies the maximum serialization depth

You can check the correct answer by solving this task in the CodeWorlds game.