Last active
July 25, 2024 07:27
-
-
Save Kcko/56d485c7b50be10c9a25b33f96efdfde to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copied from https://javascript.plainenglish.io/structuredclone-the-easiest-way-to-deep-clone-objects-in-javascript-c503b536266b | |
const testData = { | |
number: 123, | |
string: "test", | |
undefined: undefined, | |
null: null, | |
boolean: true, | |
object: { a: 1, b: { c: 2 } }, | |
array: [1, 2, { d: 3 }], | |
function: function() { return "hello"; }, | |
map: new Map([["key1", "value1"], ["key2", "value2"]]), | |
set: new Set([1, 2, 3]), | |
date: new Date(), | |
error: new Error("An error occurred"), | |
regex: /test/i, | |
domNode: document.createElement("div") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment