Skip to main content
0:01est. 2 min

Chapter 31- Objects and Object Literals

Notes

var person = {}; //object literal same as new Object(); but this is much faster

var Tony = {
firstname:'Tony'
};
function greet (person){
console.log("Hi " + person.firstname);
}
greet(Tony);

//Create an object on the fly
greet({firstname:'Tony',lastname:'Doe'});