Skip to content

Instantly share code, notes, and snippets.

@tamzinblake
Created October 12, 2011 21:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tamzinblake/1282682 to your computer and use it in GitHub Desktop.
Save tamzinblake/1282682 to your computer and use it in GitHub Desktop.
fixed array function
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