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);
() => {}This is the arrow function of ES6. Set webstorm to support ES6.
Change the configuration. I am using PhpStrom, but it should be similar.
=>
Arrow function, introduced here:Arrow function
Switch on
webstorm
中需要打开ES6
:Settings -> Language & Framework -> JavaScript -> Set the right side to
ECMAScript6
Lambda expression is only supported by es6