Test name | Executions per second |
---|---|
array length | 381419.9 Ops/sec |
array length > 0 | 368250.4 Ops/sec |
var arr = [];
if (arr.length) {
console.log(1);
} else {
console.log(0);
}
if (arr.length > 0) {
console.log(1);
} else {
console.log(0);
}