Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

object assign js

const user = { name: 'user', password: 'user'}
const admin = { name 'admin', rights: 'root'}

let merge = Object.assign({}, user, admin) 
console.log(merge) 
// {name 'admin', password: 'user', rights: 'root'}

merge = {...user, ...admin} 
console.log(merge)
// {name 'admin', password: 'user', rights: 'root'}
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #object #assign #js
ADD COMMENT
Topic
Name
5+2 =