MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/learnjavascript/comments/llau8d/javascript_object_merge/gnrrqg5/?context=3
r/learnjavascript • u/beforesemicolon • Feb 16 '21
28 comments sorted by
View all comments
1
Nice but you can do it in one line:
let object_1 = {hello: "World"}; let object_2 = {another: "Thing"}; //Object 1 props overwrite that of object 2. let merged = {...object_1, ...object_2};
1 u/backtickbot Feb 17 '21 Fixed formatting.Hello, --Explosion--: code blocks using triple backticks (```) don't work on all versions of Reddit!Some users see this / this instead.To fix this, indent every line with 4 spaces instead.FAQYou can opt out by replying with backtickopt6 to this comment.
Fixed formatting.
Hello, --Explosion--: code blocks using triple backticks (```) don't work on all versions of Reddit!
Some users see this / this instead.
To fix this, indent every line with 4 spaces instead.
FAQ
You can opt out by replying with backtickopt6 to this comment.
1
u/--Explosion-- Feb 17 '21
Nice but you can do it in one line: