<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title>移除返回数组相同字段</title> <style> .title{ width: 100%; height: 1.5rem; line-height: 1.5rem; background: red; text-align: center; font-size: .65rem; /* font-size: 0.65rem; */ } </style> </head> <body> <div class="title">看打印效果</div> </body> <script type="text/javascript"> var arr = []; var arr1 = ['儿童发展障碍','内科']; var arr2 = [{"departmentTypeId":2767,"endTime":"2022-07-15","id":53,"isStop":false,"name":"儿童发展障碍","reason":null,"startTime":"2021-07-15"},{"departmentTypeId":2767,"endTime":"2022-07-15","id":54,"isStop":false,"name":"儿科","reason":null,"startTime":"2021-07-15"}]; for(var i=0; i<arr2.length; i++) { if(!arr1.includes(arr2[i].name)) { arr.push(arr2[i]); } } console.log(arr); </script> </html>