How to use a variable as a key in a JavaScript object

Using a variable as a key is common when developing software, and with ES2015, JavaScript has made it easier to do. A variable or a JavaScript expression can be wrapped in [] to make the key of the object dynamic. This feature is called computed property names.

let variable = 'Label'
let i = 1;

{
[variable]: 'value',
[i + 1]: 'value',
[variable.toLowerCase()]: 'value'
}