So it turns out there is no built-in test for array equality in JavaScript. There are some suggestions here on StackOverflow, but I wanted to see if there was a simple answer using Functional Javascript.
Here’s my attempt:
ArrayEq: function(a1,a2) {
return reduce("x && y",true,map("x[0]==x[1]",zip(a1,a2)));
}
Reading from right to left, the zip transforms them into an array of pairs, then each pair is compared, and then the reduce applies the && operator to each boolean result in turn.