Existence checks (v2)

Revision 2 of this benchmark created by rmunson on


Preparation HTML

<script>
var topLevel={},
    topLevelFull={ other : topLevel};
    
</script>

Teardown


    delete window.notReal;
    delete window.notReal2;
  

Test runner

Ready to run.

Testing in
TestOps/sec
typeof
if(typeof topLevel==='undefined'){
    var topLevel={};
}

if(typeof topLevelFull==='undefined'){
    var topLevelFull={};
}

if(typeof notReal==='undefined'){
    var notReal={};
}

if(typeof notReal2==='undefined'){
    var notReal2={};
}
ready
Falsey
if(!this.topLevel){
    var topLevel={};
}

if(!this.topLevelFull){
    var topLevelFull={};
}

if(!this.notReal){
    var notReal={};
}
if(!this.notReal2){
    var notReal={};
}
ready
Object
this.topLevel=Object(this.topLevel);
this.topLevelFull=Object(this.topLevelFull);
this.notReal=Object(this.notReal);
this.notReal2=Object(this.notReal2);
ready
in
if(!('topLevel' in this)){
    var topLevel={};
}

if(!('topLevelFull' in this)){
    var topLevelFull={};
}

if(!('notReal' in this)){
    var notReal={};
}
if(!('notReal2' in this)){
    var notReal={};
}
ready

Revisions

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

  • Revision 1: published by maven_peace on
  • Revision 2: published by rmunson on