Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

nodejs merge 2 objects

const first = {  
  name: 'Marcus',
  sub: { eyes: 'blue' }
}

const second = {  
  name: 'Node.js',
  sub: { hair: 'brown' }
}

const merged = Object.assign({}, first, second)  
// { name: 'Node.js',
//   sub: { hair: 'brown' }
// }
Source by futurestud.io #
 
PREVIOUS NEXT
Tagged: #nodejs #merge #objects
ADD COMMENT
Topic
Name
4+3 =