const arr1 = [ '/router1/tricc1', '/router1/tricc2', '/router2/tricc1', '/router2/tricc2', '/router3/tricc1', '/router3/tricc2', ] const arr2 = [ 'router1', ] const intervenemenuarr = arr1.filter(item => { return arr2.find(prop => { return item.includes(prop); }); }); console.log(intervenemenuarr) // ['/router1/tricc1','/router1/tricc2',]
标签:tricc1,找出,tricc2,const,router1,filter,数组 From: https://www.cnblogs.com/qing1224/p/16966486.html