It won't work in JS because arrays are compared by reference, so it would always fail to match (I think immutable data structures, at proposal stage 2, would provide one potential fix for this, otherwise need a workaround such as bitmasking the array before performing a match). It not working isn't simply that pattern matching isn't present in the language, per se.