I often use the following simple higher-order function:
splat = function(fun, thisp) {
return function() { return fun.call(thisp, [].slice.call(arguments)) }
}
e.g.
"a1b2c3d4e5f6".replace(/(\D)(\d)/g, splat(function(a) {
return a[1].toUpperCase() + (++a[2]);
}))