Skip to content

QuizNot attempted

structuredClone limits

Which value makes structuredClone THROW?
1–4 to choose, Enter to submit
Show answer & explanation

Correct answer:

  • An object containing a function
  • structuredClone throws a DataCloneError for values it can't serialize, notably functions (and DOM nodes, symbols).
  • Not a Map of Dates: Map and Date are both supported.
  • Not a circular reference: cycles are preserved, unlike JSON.
  • Not a Set of NaN: Set and NaN clone fine.
  • Class instances don't throw but come back as plain objects (prototype lost).