get a property of an object javascript code example
Example 1: javascript dynamically access object property
var person ={"first_name":"Billy","last_name":"Riley"};
var property_name="first_name";
alert(person[property_name]);
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);