Explicitly set radix for parseInt
Define variable just once
Use type cast safe comparison

The values like true, '' or 0 could compare to lot of other stuff with
type casting.