javascript check if boolean variable is defined