javascript check if variable is defined and not null