JSFiddle - React, Tailwind, and code Playground
by akang2
JavaScript
//Act 7.2 Writing a Literal Object
/*
Two ways to write and interact with objects:
Dot notation
var theObject = {
sides: 4,
color: 'red',
size: '100ft'
}
//The statement below will result in 4
console.log (theObject.sides);
Bracket notation
//The statement below will result in 4
console.log(theObject['sides']);
*/
var person = {
name: 'kelly',
city: 'fresno',
email: '[email protected]'
};
console.log(person.name + " lives in the shitty town of " + person.city);
console.log(person['name'] + " lives in the shit town of " + person['city']);