javascript set value only if not null