Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

way better swap function - now works in-place on objects and arrays (…

…primitives are always pass by value so they will never work)
  • Loading branch information...
commit 51508738649880f0cf0761ff3bc43284c559d4fb 1 parent 91f825c
@Ilink authored
Showing with 1 addition and 5 deletions.
  1. +1 −5 util.js
View
6 util.js
@@ -5,11 +5,7 @@ var Util = function(){};
objects and arrays muat have the same number of elements / properties
objects must have the same property names
- Usage:
-
- a = 1; b = 2;
- result = swap(a,b);
- a = result[0]; b = result[1];
+ numbers cannot be swaped in-place since they are never passed by reference
*/
Util.prototype.swap = function(a, b) {
var temp;
Please sign in to comment.
Something went wrong with that request. Please try again.