try/catch and if/else

Benchmark created by John Bernardo on


Preparation HTML

<section id=target-m>#target-me</section>
<script>
 var t = document.getElementById('target-me') || {},
     p = document.createElement('p');
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
try/catch
try {
 t.appendChild(p);
} catch (e) {
 console.log(e);
}
ready
if/else
if ('appendChild' in t) {
 t.appendChild(p);
} else {
 console.log(new TypeError);
}
ready

Revisions

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

  • Revision 1: published by John Bernardo on