I’ve written this peace of code:
var a=function(){
};
a.name="test";
a.prop="test2";
Now if I debug the code with the console:
console.log(a.name);
console.log(a.prop);
In Firefox i get a.name="test" and a.prop="test2", while in Safari and Chrome i get a.prop="test2" but a.name="".
It seems that there’s no way to assign a “name” property on a function in Webkit browsers. Do you know why? But the most important thing is, do you know a workaround for that?
Function instances have a non-standard
nameattribute which will return the name of the function, or an empty string if the function is anonymous (like yours). Browsers will react differently when you try to write to the attribute, so I suggest using another property-name.