<script> var array1 = ['2023-04-05','2023-04-06','2023-04-07']; //array1 var array2 = ['2023-04-07']; //array2 found1 = array1.find((val, index) => { //在array1中查找日期 return array2.includes(val); }); $('.show').html(found1); </script>
The result is 2023-04-07. How to get results similar to 2023-04-05, 2023-04-06
You can use
Array#filter
to get all elements in the first array that are not in the second array.