Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
let ret = {};
let src = {
a: {
b: 1
},
run: () => {},
c: undefined
};
ret = JSON.parse(JSON.stringify(src)); // undefindの場合プロパティ消える
src.a.b = 'test';
console.log(ret); // { a: { b: 1 } }
console.log(src); // { a: { b: 'test' }, run: [Function: run], c: undefined }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment