Test name | Executions per second |
---|---|
If | 7000582.0 Ops/sec |
Switch | 6978481.5 Ops/sec |
function testIf() {
if (1 === 3) {
return false;
} else if (1 === 2){
return false;
} else if (1 === 1){
return true;
}
}
function testSwitch() {
switch (1) {
case 3:
return false;
case 2:
return false;
case 1:
return true;
}
}
testIf()
testSwitch()