Замена двух элементов в массиве javascript [дубликат]

Possible Duplicate:
Javascript swap array elements

I have a array like this:

this.myArray = [0,1,2,3,4,5,6,7,8,9];

Now what I want to do is, swap positions of two items give their positions. For example, i want to swap item 4 (which is 3) with item 8 (which is 7) Which should result in:

this.myArray = [0,1,2,7,4,5,6,3,8,9];

How can I achieve this?

36
задан Community 23 May 2017 в 12:10
поделиться