Chrome and Safari strange behaviour in Javascript
Posted
by mck89
on Stack Overflow
See other posts from Stack Overflow
or by mck89
Published on 2010-06-11T13:25:47Z
Indexed on
2010/06/11
13:32 UTC
Read the original article
Hit count: 266
Hi, 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?
© Stack Overflow or respective owner