Skip to main content
Active reading [<https://english.stackexchange.com/questions/4645/is-it-ever-correct-to-have-a-space-before-a-question-or-exclamation-mark#comment206109_4645>].
Source Link
Peter Mortensen
  • 31.1k
  • 22
  • 111
  • 134

Here's an ES6 way to remove the entry easily  :

let myObject = {
  "ircEvent": "PRIVMSG",
  "method": "newURI",
  "regex": "^http://.*"
};

const removeItem = 'regex';

const { [removeItem]: remove, ...rest } = myObject;

console.log(remove); // "^http://.*"
console.log(rest); // Object { ircEvent: "PRIVMSG", method: "newURI" }

Here's an ES6 way to remove the entry easily  :

let myObject = {
  "ircEvent": "PRIVMSG",
  "method": "newURI",
  "regex": "^http://.*"
};

const removeItem = 'regex';

const { [removeItem]: remove, ...rest } = myObject;

console.log(remove); // "^http://.*"
console.log(rest); // Object { ircEvent: "PRIVMSG", method: "newURI" }

Here's an ES6 way to remove the entry easily:

let myObject = {
  "ircEvent": "PRIVMSG",
  "method": "newURI",
  "regex": "^http://.*"
};

const removeItem = 'regex';

const { [removeItem]: remove, ...rest } = myObject;

console.log(remove); // "^http://.*"
console.log(rest); // Object { ircEvent: "PRIVMSG", method: "newURI" }

put your code in code snippet so other users could see the result
Source Link
CertainPerformance
  • 373.8k
  • 55
  • 355
  • 359

Here's an ES6 way to remove the entry easily :

    let myObject = {
      "ircEvent": "PRIVMSG",
      "method": "newURI",
      "regex": "^http://.*"
    };

    const removeItem = 'regex';

    const { [removeItem]: remove, ...rest } = myObject;

    console.log(remove); // "^http://.*"
    console.log(rest); // Object { ircEvent: "PRIVMSG", method: "newURI" }

Here's an ES6 way to remove the entry easily :

    let myObject = {
      "ircEvent": "PRIVMSG",
      "method": "newURI",
      "regex": "^http://.*"
    };

    const removeItem = 'regex';

    const { [removeItem]: remove, ...rest } = myObject;

    console.log(remove); // "^http://.*"
    console.log(rest); // Object { ircEvent: "PRIVMSG", method: "newURI" }

Here's an ES6 way to remove the entry easily :

let myObject = {
  "ircEvent": "PRIVMSG",
  "method": "newURI",
  "regex": "^http://.*"
};

const removeItem = 'regex';

const { [removeItem]: remove, ...rest } = myObject;

console.log(remove); // "^http://.*"
console.log(rest); // Object { ircEvent: "PRIVMSG", method: "newURI" }

put your code in code snippet so other users could see the result
Source Link

Here's an ES6 way to remove the entry easily :

let myObject = {
  "ircEvent": "PRIVMSG",
  "method": "newURI",
  "regex": "^http://.*"
};

const removeItem = 'regex';

const { [removeItem]: remove, ...rest } = myObject;

console.log(remove); // "^http://.*"
console.log(rest); // Object { ircEvent: "PRIVMSG", method: "newURI" }

    let myObject = {
      "ircEvent": "PRIVMSG",
      "method": "newURI",
      "regex": "^http://.*"
    };

    const removeItem = 'regex';

    const { [removeItem]: remove, ...rest } = myObject;

    console.log(remove); // "^http://.*"
    console.log(rest); // Object { ircEvent: "PRIVMSG", method: "newURI" }

Here's an ES6 way to remove the entry easily :

let myObject = {
  "ircEvent": "PRIVMSG",
  "method": "newURI",
  "regex": "^http://.*"
};

const removeItem = 'regex';

const { [removeItem]: remove, ...rest } = myObject;

console.log(remove); // "^http://.*"
console.log(rest); // Object { ircEvent: "PRIVMSG", method: "newURI" }

Here's an ES6 way to remove the entry easily :

    let myObject = {
      "ircEvent": "PRIVMSG",
      "method": "newURI",
      "regex": "^http://.*"
    };

    const removeItem = 'regex';

    const { [removeItem]: remove, ...rest } = myObject;

    console.log(remove); // "^http://.*"
    console.log(rest); // Object { ircEvent: "PRIVMSG", method: "newURI" }

Source Link
John Doe
  • 1.2k
  • 3
  • 14
  • 30
Loading