Created
April 26, 2016 19:45
-
-
Save easierbycode/482ddfa68e771bbdf7f00ededc4fb85d to your computer and use it in GitHub Desktop.
dynamic properties within an object
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
'use strict'; | |
var ident = 'productId'; | |
var productView = { | |
get [ident] () { return true; }, | |
set [ident] (value) { } | |
}; | |
console.log( productView.productId ) | |
// true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment