Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save easierbycode/482ddfa68e771bbdf7f00ededc4fb85d to your computer and use it in GitHub Desktop.
Save easierbycode/482ddfa68e771bbdf7f00ededc4fb85d to your computer and use it in GitHub Desktop.
dynamic properties within an object
'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