var mas = [ [1,2,3], [4,5,6] ] function change(arr, index) { var a = arr[0][index] var b = arr[1][index] arr[0][index] = b arr[1][index] = a } change(mas, 0) alert(mas)