Skip to content
Onsite

Output: JSON.stringify of undefined, a function, NaN and a Date inside an object and an array

MediumP2Output

What does this code print?

1console.log(JSON.stringify({ a: undefined, b: () => 1, c: NaN, d: new Date(0) }));
2console.log(JSON.stringify([undefined, () => 1, NaN, new Date(0)]));
3console.log(JSON.stringify(undefined));
Saved automatically

One line per console.log. Arrays as [1, 2, 3], objects as { a: 1 }, an uncaught error as Uncaught TypeError: message (Chrome and Node wording).

Hints

Saved automatically