Created
May 13, 2020 20:49
-
-
Save ramazankanbur/0a681641cf9869af3f36930e82480636 to your computer and use it in GitHub Desktop.
This file contains 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
var obj = function fn1() { | |
return { x: 'val1', y: 12, z: 'val2' }; | |
}; | |
//ES5 | |
var resES5 = obj(); | |
var x = resES5.x; | |
var y = resES5.y; | |
var z = resES5.z; | |
console.log(x, y, z); | |
//output | |
//val1 12 val2 | |
//ES6 | |
var { x, y, z } = obj(); | |
console.log(x, y, z); | |
//output | |
//val1 12 val2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment