const arr: string[] = ['pom', '皮蛋编程', '非常厉害', '太棒了']; const filteredArr: string[] = arr.filter((str: string) => { return str.includes('编程'); }); console.log(filteredArr); // ["皮蛋编程"]
arr是数组includes():包含
只返回匹配对象结果