Multi-Conditional

JavaScript performance comparison

Test case created

Info

Tests string for multiple values

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var action1 = "select";
};
</script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Standard Conditional (IS)
(action1=="details"||action1=="select")
pending…
Standard Conditional (IS NOT)
(action1!="details"||action1!="select")
pending…
Array indexOf (IS)
(!~~["select","details"].indexOf(action1))
pending…
Array indexOf (IS NOT)
(!~["select","details"].indexOf(action1))
pending…
Array indexOf (IS) 2
(!!~["select","details"].indexOf(action1))
pending…
Standard Conditional (IS NOT) 2
!(action1=="details"||action1=="select")
pending…

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

Compare results of other browsers

0 comments

Add a comment