gpt4 book ai didi

node.js - nodejs v4中默认参数的哪个和谐标志

转载 作者:IT老高 更新时间:2023-10-28 23:15:15 26 4
gpt4 key购买 nike

我正在使用 node.js v4.0.0 并试图让一些代码工作而无需先进行转换。虽然大多数都在工作,但我无法使用

import

这可能是因为尚未完成的阶段,但我也找不到启用它的标志。我都试过了:

--harmony_modules (enable "harmony modules" (in progress))
--harmony_array_includes (enable "harmony Array.prototype.includes" (in progress))
--harmony_regexps (enable "harmony regular expression extensions" (in progress))
--harmony_proxies (enable "harmony proxies" (in progress))
--harmony_sloppy (enable "harmony features in sloppy mode" (in progress))
--harmony_unicode_regexps (enable "harmony unicode regexps" (in progress))
--harmony_reflect (enable "harmony Reflect API" (in progress))
--harmony_destructuring (enable "harmony destructuring" (in progress))
--harmony_sharedarraybuffer (enable "harmony sharedarraybuffer" (in progress))
--harmony_atomics (enable "harmony atomics" (in progress))
--harmony_new_target (enable "harmony new.target" (in progress))

(不用说我没有使用正则表达式... :))

虽然我得到了导入的原因,但我不明白为什么默认参数会失败,因为它们似乎已经完成,而且我找不到似乎可以处理它的标志。

是否有用于导入和默认参数的标志?

不起作用的代码是

class foo extends bar {
constructor(options = {})
....
}

错误是

unexpected = illegal token

最佳答案

Node 4 使用 Chrome 45 附带的 V8 版本 - 而 V8 v4.5.103.3 不附带默认参数,即使在标志后面也是如此。默认参数位于 Chrome 49 附带的 V8 版本中,并将在 Node 6+ 中。

关于node.js - nodejs v4中默认参数的哪个和谐标志,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32542085/

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