1delete myObject.regex;
2// or,
3delete myObject['regex'];
4// or,
5var prop = "regex";
6delete myObject[prop];
7
8
9/** Demo */
10var myObject = {
11 "ircEvent": "PRIVMSG",
12 "method": "newURI",
13 "regex": "^http://.*"
14};
15delete myObject.regex;
16
17console.log(myObject);
18
1const person1 = {};
2person1['firstname'] = 'Mario';
3person1['lastname'] = 'Rossi';
4
5console.log(person1.firstname);
6// expected output: "Mario"
7
8const person2 = {
9 firstname: 'John',
10 lastname: 'Doe'
11};
12
13console.log(person2['lastname']);
14// expected output: "Doe"