Created
October 12, 2011 21:25
-
-
Save tamzinblake/1282682 to your computer and use it in GitHub Desktop.
fixed array function
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 arrayFunction () { | |
var f = function (p, v) { | |
if (arguments.length > 1) { | |
arguments.callee[p] = v | |
} | |
return arguments.callee[p] | |
} | |
for (var i = 0; i < arguments.length; i++) { | |
f[i] = arguments[i] | |
} | |
return f | |
} | |
var a = new arrayFunction(1, 3, 4) | |
, b = new arrayFunction(1, 3, 4) | |
a(1) | |
b(0, -1) | |
a[0] | |
b[0] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment