javascript object literals code example
Example 1: objects javascript
function Dog() {
this.name = "Bailey";
this.colour = "Golden";
this.breed = "Golden Retriever";
this.age = 8;
}
Example 2: object literal javascript
var myObject = {
sProp: 'some string value',
numProp: 2,
bProp: false
};
Example 3: how to a property from a JavaScript object
delete myObject.regex;
delete myObject['regex'];
var prop = "regex";
delete myObject[prop];
var myObject = {
"ircEvent": "PRIVMSG",
"method": "newURI",
"regex": "^http://.*"
};
delete myObject.regex;
console.log(myObject);
Example 4: literal object js
var car = {type:"Fiat", model:"500", color:"white"};