gpt4 book ai didi

AngularJS promise 使用“finally”这个词。 grunt jshint 提示

转载 作者:行者123 更新时间:2023-12-02 23:25:49 25 4
gpt4 key购买 nike

AngularJS 允许在 Promise 返回后使用 finally。然而,当我运行 grunt-jshint 时,我不断得到

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

有人知道如何在 jshint 中关闭此功能吗?

最佳答案

es5选项

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

如果您使用的是 2.0.0 之前的 jshint 版本,则可以选择设置 es5 标志。从2.0.0开始,es5是默认的。我假设您使用的是旧版本。

或者

您也可以说 promise['finally'](function(){});而不是promise.finally(function(){});

查看

关于AngularJS promise 使用“finally”这个词。 grunt jshint 提示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27862845/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com