问题
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