We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 1da2ced + 731975d commit 4ecc4a1Copy full SHA for 4ecc4a1
DeepCompare.js
@@ -0,0 +1,25 @@
1
+//deep compare function for multidimensional array
2
+const deepCompare = (a, b) => {
3
+ let res = true
4
+
5
+ if(Array.isArray(a) && Array.isArray(b))
6
+ {
7
+ let count = 0;
8
9
+ while(res && count < a.length)
10
11
+ res = !a.some( (val, i) => {
12
+ return !deepCompare(val, b[i])
13
+ })
14
15
+ count++
16
+ }
17
18
+ else
19
20
+ res = (a === b)
21
22
23
+ return res
24
25
+}
0 commit comments