Skip to content

Instantly share code, notes, and snippets.

@Kcko
Last active July 25, 2024 07:27
Show Gist options
  • Save Kcko/56d485c7b50be10c9a25b33f96efdfde to your computer and use it in GitHub Desktop.
Save Kcko/56d485c7b50be10c9a25b33f96efdfde to your computer and use it in GitHub Desktop.
// 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