javascript check if value is defined and not null