Checking for deep nested properties

Benchmark created on


Preparation HTML

<script>
  var a = {b: {c: 1}};
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Exists/Normal check
if(window.a && a.b && a.b.c)
  a.b.c = 1;
ready
Exists/Try/Catch check
try {
  a.b.c = 1;
}
catch(e) {
}
ready
Undefined/Normal check
if(window.a && a.c && a.c.b)
  a.c.b = 1;
ready
Undefined/Try/Catch check
try {
  a.c.b = 1;
}
catch(e) {
}
ready

Revisions

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