What does “use strict” do in JavaScript, and what is the reasoning behind it?

前端 未结 28 3180
半阙折子戏
半阙折子戏 2020-11-21 06:05

Recently, I ran some of my JavaScript code through Crockford\'s JSLint, and it gave the following error:

Problem at line 1 character 1: Missing \"use

28条回答
  •  忘掉有多难
    2020-11-21 06:52

    use strict is a way to make your code safer, because you can't use dangerous features that can work not as you expect. And, as was written before, it makes code more strict.

提交回复
热议问题