Last active
July 13, 2017 14:56
-
-
Save vaidehijoshi/f20333f53df1d191e3fc0fdd20bd88db to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function swap(array, firstItemIndex, lastItemInde) { | |
var tmp = array[firstItemIndex]; | |
// Swap first and last items in the array. | |
array[firstItemIndex] = array[lastItemInde]; | |
array[lastItemInde] = tmp; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment