Javascript Array xorArray(arr)
// [49,50,51] ^ [52,53,54] = [5,7,5] Array.prototype.xorArray = function(arr) { if (this.length != arr.length) { return new Error("Two Arrays length is different!"); } var xorArr = new Array(); for (var i = 0; i < this.length; i++) { xorArr[i] = this[i] ^ arr[i];/*from w w w . j a va2 s . co m*/ } return xorArr; };