Why does JSHint throw a warning if I am using const?

后端 未结 17 3020
眼角桃花
眼角桃花 2020-12-12 08:18

This is the error I get when using const:



        
17条回答
  •  孤街浪徒
    2020-12-12 09:05

    When you start using ECMAScript 6 this error thrown by your IDE.

    There are two options available:

    if you have only one file and want to use the es6 then simply add below line at the top of the file.

    /*jshint esversion: 6 */
    

    Or if you have number of js file or you are using any framework(like nodejs express)you can create a new file named .jshintrc in your root directory and add code below in the file:

    {
        "esversion": 6
    }
    

    If you want to use the es6 version onward for each project you can configure your IDE.

提交回复
热议问题