What does JSON.stringify produce for this object?
const data = {
name: "Ada",
age: undefined,
greet() {
return "hi";
},
score: NaN,
tags: [undefined, () => {}, Infinity],
ids: new Set([1, 2]),
joined: {
toJSON() {
return "2024-01-01";
},
},
};
console.log(JSON.stringify(data));
console.log(JSON.stringify(undefined), JSON.stringify([undefined]));
The answer
Work out every line it logs, in order. Then check.
Checking your sign-in…