Skip to content
目录

两个数组的相同项

javascript
getArrEqual (arr1, arr2) {
  const newArr = []
  for (let i = 0; i < arr2.length; i++) {
    for (let j = 0; j < arr1.length; j++) {
      if (arr1[j] === arr2[i]) {
        newArr.push(arr1[j])
      }
    }
  }
  return newArr
},

Released under the MIT License.