Skip to content

Instantly share code, notes, and snippets.

@leiming
Last active December 15, 2015 12:59
Show Gist options
  • Save leiming/5264413 to your computer and use it in GitHub Desktop.
Save leiming/5264413 to your computer and use it in GitHub Desktop.
array reverse
var array = ["1","2","3","4","5","6","7"];
var j = array.length - 1;
var temp, i = 0;
while(i<j){
temp = array[i];
array[i] = array[j];
array[j] = temp;
i++;
j--;
}
console.log(array);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment