object property function javascript code example
Example 1: adding function to objects js
var myObj = {
myFunc: function(param){
}
}
Example 2: 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 3: js create object with properties
var mycar = new Car('Eagle', 'Talon TSi', 1993);