Includes vs conditional

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
includes (first match)
var str = "abc";
var result = ["abc", "def"].includes(str);
ready
includes (no match)
var str = "something else";
var result = ["abc", "def"].includes(str);
ready
conditional (first match)
var str = "abc";
var result = (str === "abc" || str === "def");
ready
conditional (no match)
var str = "something else";
var result = (str === "abc" || str === "def");
ready

Revisions

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