check if value is not undefined javascript