javascript check if boolean is not undefined