I just learned javascript and node.js. When I was studying an example, I found the following writing method, but webstorm directly marked the error and displayed expression expected. What is going on?
'use strict';
const fs = require('fs');
console.log('script start');
const interval = setInterval(() => {
console.log('setInterval')
}, 500);
淡淡烟草味2017-05-19 10:41:59
() => {}This is the arrow function of ES6. Set webstorm to support ES6.
我想大声告诉你2017-05-19 10:41:59
Change the configuration. I am using PhpStrom, but it should be similar.
PHPz2017-05-19 10:41:59
=>
Arrow function, introduced here:
Arrow function
Switch on webstorm
中需要打开ES6
:
Settings -> Language & Framework -> JavaScript -> Set the right side to ECMAScript6