javascript if object is not undefined