Lately I\'ve become a huge fan of the function.name
property.
For example, I\'ve written a function for extending prototypes.
It works in the w
You might be able to parse the function name from calling function.toString [docs]. function.name
is not a standard property.
var name = func.toString().match(/^function\s*([^\s(]+)/)[1];
As the comments also say, this is not necessarily a reliable way. Imo passing an object would be easier to read and you could pass several methods at once:
Array.give({
forEach: function() { ... },
somethingElse: function() {...}
});