JSFiddle - React, Tailwind, and code Playground

by Louis Lazaris

JavaScript

var myObj = {},
    myProp = 'example property';
    
myObj['other prop'] = 'example value';
myObj[myProp] = 'another value';

console.log(myObj);

// {other prop: "example value", example property: "another value"}