in vs if

Benchmark created by Jason Mulligan on


Preparation HTML

<script>
  var x = document.querySelector("body");
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
in (invalid)
if ("test" in x.dataset) { void(0); }
ready
if (invalid)
if (x.dataset["test"]) { void(0); }
ready

Revisions

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

  • Revision 1: published by Jason Mulligan on