Created
August 28, 2017 03:43
-
-
Save prof3ssorSt3v3/22b080dcef57dc404184316b95ad0b8c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Object.assign(target, sources... ) method | |
| // used to copy objects OR | |
| // to merge objects | |
| let obj1 = {"arms":true, "armCount":2}; | |
| let obj2 = {"weapons":['missle launcher', 'reciprocating saw']}; | |
| let obj3 = {"canMove":true, "legs":0, "treads":2}; | |
| let arms = Object.assign({'hasHands':true, "arms": false}, obj1); | |
| console.log( arms ); | |
| let robot = Object.assign({'hasHands':true, "arms": false}, obj1, obj2, obj3); | |
| console.log(robot); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment