Created
July 12, 2014 09:33
-
-
Save send2moran/9fcdde24645c6ef1e5b1 to your computer and use it in GitHub Desktop.
Generic arguments swapValues function
This file contains hidden or 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
var arr = [1,2,3,4]; | |
function swapValues(){ | |
return [].slice.call(arguments).reduce(function(a, b) {return a.concat(b);}).reverse(); | |
} | |
arr = swapValues(arr,5); | |
console.log(arr) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment