为什么IE9会在chrome和mozilla时返回语法错误

Pau*_*ndo -1 javascript internet-explorer cross-browser

为什么IE 9控制台在chrome和mozilla控制台解析代码时返回语法错误

 var browserDetect={
 init:function  () {
    this.Osystem()
    this.browserFeatures()
    },
  Osystem:function  () {
    console.log(navigator.platform);
    },
  browserFeatures:function  () {
    if (navigator.appName=="Netscape") {
        var Net=parseInt(navigator.appVersion);
        console.log(Net)
    }
    else if (navigator.appName=="Microsoft Internet Explorer"){
        var IE=parseInt(navigator.appVersion);
        console.log(IE)
    }
    else{
        console.log(navigator.appName)
    }
         },
     };
  browserDetect.init();
Run Code Online (Sandbox Code Playgroud)

返回的错误是 SCRIPT1028: Expected identifier, string or number line 22 character 1

Mar*_*c B 5

提示:如果您在特定行上出现错误,那么准确显示该行是有帮助的.特别是如果你正在处理代码片段并且没有显示所有行开头.

问题出在这里:

}
     },   <---dangling comma
 };
Run Code Online (Sandbox Code Playgroud)

IE尤其对这类事情非常愚蠢.