Created
May 12, 2020 22:39
-
-
Save ramazankanbur/a8bc40a8b3215985f11615681e39cd38 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
| //ES5 | |
| var indexFn = function () { | |
| return 1; | |
| }; | |
| var objES5 = { | |
| name: 'Can', | |
| }; | |
| objES5['Columnn' + indexFn()] = 42; | |
| console.log(objES5); | |
| //output | |
| // { name: 'Can', Columnn1: 42 } | |
| //ES6 | |
| let objES6 = { | |
| name: 'Can', | |
| ['Columnn' + indexFn()]: 42, | |
| }; | |
| console.log(objES6); | |
| //output | |
| // { name: 'Can', Columnn1: 42 } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment