In JavaScript, you could access properties with both, bracket and dot notations like so:
var person = {
firstname: 'Jhon',
lastname: 'Doe'
};
console.log(person.firstname + ' ' + person.lastname);
console.log(person['firstname'] + ' ' + person['lastname']);
And, if I did something like the following:
var person = {
'first name': 'Jhon',
'last name': 'Doe'
};
// The following won't work:
// console.log(person.first name + ' ' + person.last name);
console.log(person['first name'] + ' ' + person['last name']);
My question is: Is there a trick or a hack to access person['first name'] and person['last name'] with the dot notation?