nodejs v4中默认参数的哪个和声标志

chr*_*con 10 node.js ecmascript-6

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

import
Run Code Online (Sandbox Code Playgroud)

这可能是因为没有最终确定的阶段,但我也找不到启用它的标志.我尝试了所有这些:

--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))
Run Code Online (Sandbox Code Playgroud)

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

当我得到导入的原因时,我不明白为什么默认参数失败,因为它们似乎已经完成,我找不到似乎处理它的标志.

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

不起作用的代码是

class foo extends bar {
    constructor(options = {})
    ....
}
Run Code Online (Sandbox Code Playgroud)

错误是

意外的=非法令牌

Sea*_*ira 12

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

  • 正确 - 我修改了答案,明确表示我指的是Chrome 45附带的V8版本,我只是使用chromestatus作为跟踪底层V8引擎进度的便利位置.如果我能做任何进一步的改进答案,请告诉我! (2认同)

小智 6

国旗是: --harmony_default_parameters