Samman Thapa Samman Thapa - 3 months ago 6x
Node.js Question

Should.js: check if two arrays contain same strings

I have two arrays:

var a = ['a', 'as', 'sa'];
var b = ['sa', 'a', 'as'];

Is there anything special in shouldJS to test if these two arrays have same items? Anything Like


that can test them? Here, xyz is what I am looking for.


A naive, but possibly sufficient solution would be to sort the arrays before comparing them:


Note that sort() works in-place, mutating the original arrays.