Skip to content

Instantly share code, notes, and snippets.

@syedjafer
Created April 28, 2021 11:18
Show Gist options
  • Select an option

  • Save syedjafer/a5e8fc8f76a72664527ea6e26e2bfe2d to your computer and use it in GitHub Desktop.

Select an option

Save syedjafer/a5e8fc8f76a72664527ea6e26e2bfe2d to your computer and use it in GitHub Desktop.
var arr = [1, 3, 4, 5, 6];
for (var itr=0; itr< arr.length/2 ; itr++){
var temp = arr[itr];
arr[itr] = arr[arr.length-1-itr];
arr[arr.length-1-itr] = temp;
}
console.log(arr);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment