Answers for "how to a property from a JavaScript object"

3

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);
Posted by: Guest on November-27-2019

Code answers related to "how to a property from a JavaScript object"

Code answers related to "Javascript"

Browse Popular Code Answers by Language