javascript 代码在 Internet Explorer 中显示错误,但在 FF 中没有。
$(document).ready(function(){
var countries = [
["Afghanistan","Af"],
["Åland Islands","Ax"],
["Zimbabwe","Zw"]
];
var countryNames = countries.map(function(country){
return {
/*label: '<div class="flag '+country[1].toLowerCase()+'">'+country[0]+'</div>',*/
value: country[0]
}
var my_var=countryNames();
});
});
在 IE 8 开发者工具中,如果我调试 js,错误信息是:'对象不支持这个属性或方法'。错误在以以下行开头的代码段中指示:
var countryNames = countries.map(function(country){
如何使代码在 IE 中工作?