qq_笑_17
您可以使用filter()和hasOwnProperty()let arr = ['detail','add','remove','checkout','purchase'];let obj = {detail:'val',add:0,purchase:33}let res = arr.filter(x => obj.hasOwnProperty(x));console.log(res)没有箭头功能let arr = ['detail','add','remove','checkout','purchase'];let obj = {detail:'val',add:0,purchase:33}let res = arr.filter(function(x){ return obj.hasOwnProperty(x) }) console.log(res)