【发布时间】:2014-08-26 22:20:10
【问题描述】:
考虑在 IE8 和 Chrome 控制台中运行以下代码进行比较:
var a = function(){ console.log("function is() initialized"); };
// assign a property named 'function' to function 'a'
a.function = function afunction(f){ return (typeof f === 'function'? true: false); };
// Use our is function to test if a given variable is a function
a.function(a); // IE throws 'expected identifier' error v/s Chrome correctly outputs "true"
任何想法如何在不更改函数签名的情况下在 IE8 中解决此问题:a.function()?
【问题讨论】:
标签: javascript google-chrome internet-explorer-8