Skip to content

Instantly share code, notes, and snippets.

Created May 9, 2017
What would you like to do?
* 交换数组的位置
* @param arr
* @param i {Number} 旧的位置
* @param j {Number} 新的位置
* @returns {*}
function swap(arr, i, j) {
let tmp = arr[i]
arr[i] = arr[j]
arr[j] = tmp
return arr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment