javascript assign value only if not null