Determining whether one array contains the contents of another array in JavaScript/CoffeeScript

后端 未结 5 747
孤独总比滥情好
孤独总比滥情好 2020-12-02 18:20

In JavaScript, how do I test that one array has the elements of another array?

arr1 = [1, 2, 3, 4, 5]
[8, 1, 10, 2, 3, 4, 5, 9].function_name(arr1) # => t         


        
5条回答
  •  天涯浪人
    2020-12-02 18:57

    I faced the same case if I got you exactly, my case was to check visited places while one trip, every trip have its own point and we have a data for all working area places, here is the code maybe help you.

    https://stackblitz.com/edit/trips-calculator?file=index.js

提交回复
热议问题