Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const x = {
- foo: 29
- };
- const y1 = { foo: 42 };
- const y2 = {};
- const y3 = { foo: null };
- const y4 = { foo: undefined };
- console .log(Object.assign({}, x, y1));
- console .log(Object.assign({}, x, y2));
- console .log(Object.assign({}, x, y3));
- console .log(Object.assign({}, x, y4));
- console.log('-------------- curve ball ---------')
- console .log(Object.assign({}, x, JSON.parse(JSON.stringify(y3))));
- console .log(Object.assign({}, x, JSON.parse(JSON.stringify(y4))));
Add Comment
Please, Sign In to add comment