javascript function to create object code example
Example 1: creating an object javascript
let obj = {
// fields
name:"value",
num: 123,
//methods
foo: function(){}
}
Example 2: how to a property from a JavaScript object
delete myObject.regex;
// or,
delete myObject['regex'];
// or,
var prop = "regex";
delete myObject[prop];
/** Demo */
var myObject = {
"ircEvent": "PRIVMSG",
"method": "newURI",
"regex": "^http://.*"
};
delete myObject.regex;
console.log(myObject);