javascript get property if exists