Is there a shorter way (probably using short circuiting) to write the if part of the for-loop?
let range = new Array()
for (let i = 0; i < buckets.length; i++) { //bucket is an array of sets.
if (buckets[i].size > 0) {
range[0] = i; //set index of the first none-empty element in buckets to be range[0]
break;
}
}