js swap array ES6 swap array 就地交换 no need let , const [ b, a, ] = [ a, b, ]; // ES6 swap const arr = [1, 2]; [ arr[0], arr[1], ] = [ arr[1], arr[0], ]; arr; // (2) [2, 1] ES5 /** * @param {character[]} s * @return {void} Do not return anything, modif…