0 votes
1 view
in Java by (9.2k points)

Below is the object I created:

let myObject = {

  "ircEvent": "PRIVMSG",

  "method": "newURI",

  "regex": "^http://.*"

};

I want to know how to remove the property regex to end up with new myObject as follows?

1 Answer

0 votes
by (19k points)

You can remove the property from an object like below:

delete myObject.regex;

// or,

delete myObject['regex'];

// or,

var prop = "regex";

delete myObject[prop];

Interested in Java? Check out this Java Certification by Intellipaat.  

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...