简体   繁体   中英

angularjs promises use the word finally. grunt jshint complains

AngularJS allows the use of finally after the return of a promise. However, when I have a grunt-jshint running I keep getting

Expected an identifier and instead saw 'finally' (a reserved word).

Does any one know how to turn this off in jshint?

es5 option

This option enables syntax first defined in the ECMAScript 5.1 specification. This includes allowing reserved keywords as object properties.

If you are using a version of jshint prior to 2.0.0, then you have the option of setting an es5 flag. Starting with 2.0.0, es5 is the default. I assume you are using an older version.

Alternatively

You can also say promise['finally'](function(){}); rather than promise.finally(function(){});

See

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM