简体   繁体   中英

Internet Explorer Function Inside a Function Does Not Work

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?

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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM