[removed] efficiently compare two integer arrays

后端 未结 6 1315
庸人自扰
庸人自扰 2020-12-30 03:14

I have two integer arrays which contain numeric values. I want to look through both lists and check for commonality (or lack of) between the lists. I.e. I want to iterate th

6条回答
  •  忘掉有多难
    2020-12-30 04:04

    Everyone is overly complicating this. Here's a one liner:

    var isEqual = (JSON.stringify(arr1.sort()) === JSON.stringify(arr2.sort()));
    

提交回复
热议问题