How would you assign a property to an object?
One way to assign a property to an object literal is by using the dot syntax approach. The dot syntax approach is straightforward, start with the object's name and use the dot for the next level in the object tree until you get the needed key.
const obj = {};
obj.title = "icodepixels";
Another way would be to use the square brackets. You will use the square bracket approach when the property name contains spaces or special characters. The square brackets approach to assigning a property to an object also requires that the key is a string type.
const obj = {};
obj["first name"] = "Jason";