gpt4 book ai didi

javascript - 是否可以在 CoderPad 中使用 ES6 关键字 `import`?

转载 作者:行者123 更新时间:2023-11-29 21:15:19 25 4
gpt4 key购买 nike

背景

我正在尝试在 coderpad.io 中导入 underscore 库(又名 CoderPad)

此 ES5 语法有效:

const _ = require('underscore')

这个 ES6 语法不会:

import * as _ from 'underscore'

问题

是否可以在 CoderPad 中使用 ES6 import 关键字? (如果是,如何?如果不是,为什么不?)

最佳答案

来自他们的 Supported Languages页:

Running NodeJS v6

We run NodeJS with the --harmony flag on, which gives you access to most of the features in the upcoming JavaScript ES6 spec. For a complete description of which ES6 features are available, check out the Node compatibility table. Your code is also run for you in strict mode by default, which will enable most ES6 features to work without configuration on your part.

它使用 Node v6,它实现了大部分 ES6,但是 not modules .

关于javascript - 是否可以在 CoderPad 中使用 ES6 关键字 `import`?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39660486/

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