underscore.js - Determine if all values in an array of arrays match

后端 未结 9 2121
迷失自我
迷失自我 2020-12-20 11:30

I have an array of arrays, which looks something like this:

[[\"Some string\", \"Some other string\"],[\"Some third string\", \"some fourth string\"]]
         


        
9条回答
  •  执念已碎
    2020-12-20 12:06

    Why not intersection? (if you really want to use some Underscore functions for this) http://underscorejs.org/#intersection

    If the arrays are of the same length, and the length of the intersection equals to the length of the arrays, then they all contain the same values.

提交回复
热议问题