Node.js examples for Array:Swap
Returns the array as a string with set notation, e.g.: [1,2,3] -> {1,2,3}
Array.prototype.set = function () { var copy = this.slice(); copy.sort()// w ww . ja v a 2 s . co m var result = "{" + copy[0]; for (var i = 1; i < copy.length; i++) result += "," + copy[i]; result += "}"; return result; };