Arrow function “expression expected” syntax error

天涯浪子 提交于 2019-11-30 02:39:01

I had the error expression expected reported by Webstorm when editing a Node.js program. In this case the solution is to set the language version to a version that supports this feature.

The following is what i did that work for me. (1) I change the JavaScript language option to ECMAScript 6 as show in the selected answer by @Joe23

(2) I close the Webstorm project/application.

(3) Navigate to the project folder and delete the .idea folder in it. I believe this is the folder webstorm generated to keep information about the project/application.

(4) I reopen my project in webstorm and the errors are gone.

Your syntax is correct and Nodejs supports arrow functions, but you it's not enabled by default.

You should add the "--harmony" flag when you start the node process to enable it.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!