I get the error SCRIPT1003: Expected ':' in IE 11; (Java Script Code error)

℡╲_俬逩灬. 提交于 2019-12-25 11:51:30

问题


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();
        },
    };
}]);

Any ideas? Thank you


回答1:


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)



来源:https://stackoverflow.com/questions/46651124/i-get-the-error-script1003-expected-in-ie-11-java-script-code-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!