Block-scoped declarations not yet supported outside strict mode

后端 未结 7 1635
小蘑菇
小蘑菇 2020-12-04 19:26

I\'m running Laravel 5.4 on my Homestead vagrant box. I\'ve installed all the npm dependencies with npm install command. That didn\'t produce a

7条回答
  •  无人及你
    2020-12-04 20:02

    I had faced the same problem with one of my test script in NodeJS and i resolved my error by using ECMAScript 5's strict mode.

    "use strict";
    

    Added above line at the top of my script and it works well.

    Strict mode makes several changes to normal JavaScript semantics:

    1. Eliminates some JavaScript silent errors by changing them to throw errors.

    2. Fixes mistakes that make it difficult for JavaScript engines to perform optimizations: strict mode code can sometimes be made to run faster than identical code that's not strict mode.

    3. Prohibits some syntax likely to be defined in future versions of ECMAScript.

提交回复
热议问题