Created
April 8, 2017 20:06
-
-
Save bsommardahl/76331410d022e0b313756e776a3eb18a to your computer and use it in GitHub Desktop.
ES6 Desconstruction in Action
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
| describe('When deconstructing an object', () => { | |
| const car = { | |
| color: "red", | |
| size: "large", | |
| doors: [{section: "front", side: "driver"}, {section: "front", side: "passenger"}], | |
| make: "Nissan" | |
| }; | |
| it('should be able to deconstruct the object and get only the properties we want', () => { | |
| const {color, size, doors} = car; | |
| expect(color).to.equal("red"); | |
| expect(size).to.equal("large"); | |
| expect(doors.length).to.equal(2); | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment