Quiz di JavaScript: JSON

This JavaScript quiz checks the everyday use of JSON.stringify() and JSON.parse(). You will predict the JSON text for common values, see which values are dropped or changed, and spot invalid JSON.

Facile 10 domande ~5 minuti Superato con il 80% Node.js 22

Scegli una modalità

Stai giocando come ospite: accedi per salvare XP e serie.

Domanda di esempio

Domanda 1 di 10

What does this print?

console.log(JSON.stringify({ a: 1, b: "x" }));
Mostra la risposta

B. {"a":1,"b":"x"} JSON.stringify() returns compact JSON text: keys in double quotes, numbers unquoted, no spaces. [object Object] is what String(obj) would give.

Cosa copre questo quiz

  • JSON.stringify() output for objects and arrays
  • What happens to undefined, functions, NaN and dates
  • JSON.parse() and the strict JSON syntax
  • Picking keys with a replacer and customizing with toJSON()
  • Circular references

Domande frequenti

Serve un account?

No. Chiunque può giocare. Accedi per salvare XP, serie, badge e cronologia.

Posso rifarlo?

Sì. Il tuo miglior punteggio resta salvato, e domande e risposte vengono mescolate ogni volta.