I realize that JavaScript allows both dot notation and bracket notation to create and access object properties. Other than when the property name contains a space or other reserved character or when the property name is a variable in which brackets are required for both scenarios, when should one approach be used over the other? Difference between using bracket (`[]`) and dot (`.`) notation indicates that dot notation should always be used unless there is a specific reason not to. Is this true, and if so, why?
var person={firstname:'John', 'last name':'Doe'};
console.log(person);
person.firstname='Jane';
var nameType='middlename';
//No person.nameType='Sunshine';
person[nameType]='Sunshine';
person['last name']='DoeBo';
console.log(person);
Results:
Object { firstname="John", last name="Doe"}
Object { firstname="Jane", last name="DoeBo", middlename="Sunshine"}