ARRAY:: delete vs undefined (v19)

Revision 19 of this benchmark created by Dan on


Description

The delete operator removes a property entirely. Setting a property to undefined removes the value. Setting a property to null changes the value to the null value.

Technically they are not equivalent, but in practice they are often used to mean the same thing: that a property is unset.

Preparation HTML

<script>
  o = [1,2,3,4];
  
  var undef;
  
  function reset() {
   o[2] = 3;
  }
</script>

Teardown


    reset();
  

Test runner

Ready to run.

Testing in
TestOps/sec
delete
delete o[2];
 
ready
undefined
o[2] = undef;
ready
o["2"] = undef;
 
ready

Revisions

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