Computed-Keys-In-Js

Computed Keys in JS

Good Resource

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer#syntax

You can make object keys dynamic using []

Example:

const prop = 'foo';

o = {
	[prop]: 'hello',
}
// Evaluateds to {'foo':'hello'}

#JavaScript