I am copying functions from one object to another. The problem is that while they are anonymous in the source object, they have a name in the target object:
var o1 = {
a: function() {
alert("Hello World");
},
b: 123,
c: "Some string"
}
var o2 = {};
for (var key in o1) {
if ("function" == typeof o1[key]) {
o2[key] = o1[key];
}
}
console.log(o2.a); //output: function o1.a()
The two functions do not seem to be connected in some way, but this is very irritating at least. Also, Firefox Developer Edition knows where the function came from if I log it in the console and click the name. And I don't know whether this might have some other bad influence somehow.
So, if it is possible to copy a function and keep it anonymous, that would be great!