我收到错误SCRIPT1003:在IE 11中预期':'; (Java脚本代码错误)

问题描述:

JS代码的这一特定片段在IE 11上不起作用。我收到错误SCRIPT1003:预期':'并且它表示它在线上缺少它以粗体显示。

This particular snippet of JS code does not work on IE 11. I get the error SCRIPT1003: Expected ':' and it says it is missing on line that it's in bold.

var $actions = application.service('$actions', [
function() {
    let _logout = function() {
        $('#logoutForm').submit();
    }
    return {
        **Logout() {**
            _logout();
        },
    };
}]);

任何想法?谢谢

IE11不支持速记方法名称。请参阅 MDN 的兼容性部分。使用

IE11 does not support shorthand method names. See the compatability part of the MDN. Use

return {
   Logout: function() {
       _logout();
   }
};

(或停止支持互联网爆炸,如果你有机会 - 它会引起很多麻烦)

(or stop supporting internet exploder, if you have the opportunity to - it causes a lot of headache)