Run the following code in a browser:
({ clone: structuredClone }).clone(1);
will got Uncaught TypeError: Illegal invocation
, tested in Chrome/Edge.
However running the code in NodeJS is fine, tested in NodeJS v20.
Workaround:
({ clone: (v) => structuredClone(v) }).clone(1);
Or
({ clone: function(v) { return structuredClone(v)} }).clone(1);
Is this the expected behaviour?