Created
August 12, 2016 14:56
-
-
Save KATT/774028656fbd153d6c6f0e738d9e13dd 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
const obj = { | |
a: 1, | |
b: 2, | |
c: 3, | |
d: 4, | |
}; | |
const { | |
a, | |
b, | |
...other | |
} = obj; | |
// -> | |
// a = 1 | |
// b = 2 | |
// other = { c: 3, d: 4, } | |
const { | |
a = Math.PI, | |
b = 3, | |
c = NaN, | |
d, | |
} = other; | |
// -> | |
// a = 3.14159... | |
// b = 3 | |
// c = 3 | |
// d = 4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment