function calFormErrors(errorList = []) { const formErrors = {} errorList.forEach((e) => { formErrors[e.param] = true }) return formErrors } const errorList = [{param: true,name: 'zhang'}, {param: false}] console.log(calFormErrors(errorList))