Test name | Executions per second |
---|---|
array length | 240774.5 Ops/sec |
array length > 0 | 237647.5 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);
}