Removing Variables from an Object

Benchmark created by BretCameron on


Setup

const obj = { a: 1, b: 2, c: 3 };
  
  const omit = (prop, { [prop]: _, ...rest }) => rest;

Test runner

Ready to run.

Testing in
TestOps/sec
Use Delete Statement
delete obj.a;
ready
Set Undefined
obj.a = undefined;
ready
Create a Copy
omit('a', obj)
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.

  • Revision 1: published by BretCameron on
  • Revision 2: published by MissFriday on
  • Revision 3: published by MissFriday on