It doesn't matter how gracefully es6 judges that the values contained in two arrays are exactly the same.

this is what I do now. Is there a better way?

let flag = true
    const listA = [1, 2, 3]
    const listB = [2, 3, 4]
    if (listA.length !== listB.length) {
      flag = false
    } else {
      listA.forEach(item => {
        if (listB.indexOf(item) === -1) {
          flag = false
        }
      })
    }
Mar.10,2021

it can be done in one sentence:

const checkArrSames = (arr1, arr2) => [...new Set(arr1)].length === [...new Set([...arr1, ...arr2])].length;
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e8f408-4e710.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e8f408-4e710.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?