In JavaScript, I\'ve created an object like so:
var data = {
\'PropertyA\': 1,
\'PropertyB\': 2,
\'PropertyC\': 3
};
Is it poss
ES6 for the win!
const b = 'b';
const c = 'c';
const data = {
a: true,
[b]: true, // dynamic property
[`interpolated-${c}`]: true, // dynamic property + interpolation
[`${b}-${c}`]: true
}
If you log data
you get this:
{
a: true,
b: true,
interpolated-c: true,
b-c: true
}
This makes use of the new Computed Property syntax and Template Literals.