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 way of..
Array.give(
function forEach() { ... }
);
..which would then let you do..
['a', 'b', 'c'].forEach(function () { ... });
This code works great in Chrome, Safari, Firefox, and Opera, but not in IE.
After just a small bit of digging, I realized that to the give function, function.name
was just returning undefined
, where as in everything else it returned "forEach"
.
Is there an alternative way to get the name in IE, or should I just fall out of love with this wonderful property?