Home > front end > How to determine whether to include this element in the array
How to determine whether to include this element in the array
Time:03-02
Var test=[1, 2, 3] $. InArray (1, test); That is able to judge the test have 1 this element in the array, but I'm a but for complex data not Var test=[]; Info={js: 0, name: 'aa', url: "https://123.html"}; Test. Push (info); $. InArray (info, test); So I can't find it, the returned have been 1, how to change?
CodePudding user response:
Change Var=b test. Some (e=& gt; JSON. Stringify (e) equals (JSON. Stringify (info)); The console. The log (b);//if found is true, can't find is false
CodePudding user response:
Problem has been to help you solve, the problem is js Array