Bool conditions don't work on empty lists in js