Back to questions
JuniorTheoryCommon
What does the program print?
const data = { a: undefined, b: NaN };
console.log(JSON.stringify(data));{"b":null}
- Expecting
{"b":NaN}: JSON has noNaN, soJSON.stringifywritesnullin its place. - Expecting
"a":null: a property whose value isundefinedis left out of the JSON text completely.
- What does
JSON.parsereturn for the printed text? - What happens to a property whose value is a function?