Answers for "how to access object properties js"

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
0

how to access object properties js

const person1 = {};
person1['firstname'] = 'Mario';
person1['lastname'] = 'Rossi';

console.log(person1.firstname);
// expected output: "Mario"

const person2 = {
  firstname: 'John',
  lastname: 'Doe'
};

console.log(person2['lastname']);
// expected output: "Doe"
Posted by: Guest on August-05-2021
0

how to access property of an object in javascript

objectName.propertyName
Posted by: Guest on July-06-2021

Code answers related to "how to access object properties js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language