Javascript behaves exactly the way you want:
var a = [1, 2], b = [3, 4]; console.log(a || b);
If you want a cast to boolean, you can use the double negative operator:
console.log(!![1, 2]); //will output true console.log(!!0); //will output false
source share