3 ms·
> I'm not sure if javascript saves the names of the function's parameters to be available for reflection Yes an no. YOu can't access it directly, but if you ca
by byroot 13y ago
> I'm not sure if javascript saves the names of the function's parameters to be available for reflection
Yes an no. YOu can't access it directly, but if you call toString() on a function you'll get is source code as a string so you can parse it.
Prototype do that to handle the special $super parameter [0].
But most modern minifier rename function parameters and local variables, so it's not a good idea.
[0] https://github.com/sstephenson/prototype/blob/master/src/prototype/lang/function.js#L38 https://github.com/sstephenson/prototype/blob/master/src/pro...