Is necessary to define the variable and assign it to 0? You're code is looking for falsy values. undefined would do the work as well