0

I have that script:

var information = function() {    

  this.paco= function() {  
 console.log("function called");
  };
  
  this.paco();

}();

and this:

var information = function() {    

  var paco= function() {  
    console.log("function called");
  };

  paco();

}();

but this works:

var information = function() {    
...
  this.paco= function() {  
    console.log("function called");
  };

  //this.paco();
...
}();

it works at Firefox but does not work at Internet Explorer and does not log any error to console. When I try to call a function inside information I get this log:

Object doesn't support this action

Here is some info: http://www.spilgames.com/javascript-bug-in-internet-explorer-8-and-older/ I can not put all the code because there are many scripts calls each other. Any ideas?

kamaci
  • 72,915
  • 69
  • 228
  • 366
  • Can you give more context and perhaps preceed each code snippet with what works or doesn't work. I a not clear because when I run each of those code snippets in IE and FF, they are working as they should. – james emanon Oct 10 '14 at 06:42
  • I've turned your sample into a snippet, then I went to IE and it worked... – Matías Fidemraizer Oct 10 '14 at 06:43
  • Couldn't reproduce the problem in IE 8. – thefourtheye Oct 10 '14 at 06:44
  • Why are you using `this` inside an IEFE at all? Is that property named `paco` in your actual script as well? – Bergi Oct 10 '14 at 06:44
  • Neither function has a return statement, so they return *undefined*, so *information* has a value of *undefined*. – RobG Oct 10 '14 at 06:48
  • I have tried `this` and not but did not worked. I also used `var` as explained here: http://www.spilgames.com/javascript-bug-in-internet-explorer-8-and-older/ I can not put all the code because there are many scripts calls each other. – kamaci Oct 10 '14 at 06:48

1 Answers1

0

I found the reason. It was because of

console.log("function called");

It was not working at Internet Explorer 9. There is an explanation here: Does IE9 support console.log, and is it a real function?

Community
  • 1
  • 1
kamaci
  • 72,915
  • 69
  • 228
  • 366