Why the following code does not work in Internet Explorer (I tested only in IE8 so far):
(function(){ this.foo = function foo(){}; foo.prototype = { bar:function(){ return 'bar'; } }; })(); var x = new foo; console.log(x.bar())
If I change the purpose of foo as follows, the code works very well:
var foo = this.foo = function(){};
I assume this is due to named functions in IE Javascript. The code works fine in Chrome and Firefox.
Any ideas?
javascript internet-explorer
mikeycgto
source share