Using Object literal notation: Reference
var carObj = { model: "Mercedes-Benz CLS Coupé", getModel: function() { return this.model; } } console.log(carObj.getModel()); // prints Mercedes-Benz CLS Coupé
var carObj = { model: "Mercedes-Benz CLS Coupé", getModel: function() { return this.model; } } console.log(carObj.getModel()); // prints Mercedes-Benz CLS Coupé