Clone and edit this document
Runkit
Runkit
home page
user forum
new notebook
clone notebook
download notebook
support & documentation
log in
sign up
new notebook
help & feedback
clone this notebook
download this notebook
Sign In
Sign Up
Assign vs Merge
node v4.9.1
version:
master
endpoint
share
tweet
Demonstrating the differences between a true merge and Object.assign
const merge = require('lodash.merge') const assign = Object.assign const stateA = { a : { f: 1 } } const stateB = { a : { g: 2 } } console.log('merge:', merge( {} , stateA, stateB )) console.log('assign:', assign( {} , stateA, stateB ))
Loading…
no comments
sign in
to comment