This statement is true in any language. So it's useless as a criterium for determining which language is "functional" and which isn't.
Edit: except, of course, Haskell - `xs` could be infinite, in which case the expression wouldn't be true (but bottom instead).
lolcathost% js17
js> function twice(x) { return 2*x; }
js> var xs = [1,2,3];
js> var ys = xs.map(twice);
js> var zs = xs.map(twice);
js> ys == zs
false
js>
Of course, the fundamental problem (in both Haskell and dynamic object-oriented languages) is types:(0) Haskell doesn't have a type of lists. It has a type of potentially infinite streams.
(1) Dynamic object-oriented languages don't have a type of lists. They have a (dynamic) type of objects with physical identity, whose state (mutable or otherwise) can be interpreted as a list.
ML is free of these problems. It has a bona fide type of lists. Of course, you can also define a bona fide type of streams if you want to. Or a type of dynamic objects with identity. And those will be different types.
xs = [1,2,3]
ys = [1,2,3]
# are xs and ys equal?
ys.append(4)
print(xs == ys)
# no!There is no builtin object content equality binary operator in Javascript, at least as of ES5.
λ> map acos [2] == map acos [2]
False :: Bool
Interesting. > map Math.acos [2.0] = map Math.acos [2.0];
poly: : error: Type error in function application.
Function: = : ''a * ''a -> bool
Argument: (map Math.acos [2.0], map Math.acos [2.0]) :
real list * real list
Reason: Can't unify ''a to real list (Requires equality type)
Found near map Math.acos [2.0] = map Math.acos [2.0]
Static Errors