Skip to content

Instantly share code, notes, and snippets.

@send2moran
Created July 12, 2014 09:33
Show Gist options
  • Save send2moran/9fcdde24645c6ef1e5b1 to your computer and use it in GitHub Desktop.
Save send2moran/9fcdde24645c6ef1e5b1 to your computer and use it in GitHub Desktop.
Generic arguments swapValues function
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