0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

JavaScript_"use strict"

Posted at

"use strict" : エラーチェックを行う

例1:
<script>

"use strict";

str = "test";
// コンソールにエラーが出る、str変数未定義
// 「"use strict";」ない場合、コンソールに「test」出力
console.log(str);
</script>

例2:
<script>
 function test(para){
  // 下記の範囲はtestメソッド内だけ
  "use strict";
}
</script>

※ メソッド内でも、varをついてない時、グローバル変数になる
function(){
 // varをついてないため、グローバル変数
 testName = "test";
 // varをついてるため、ローカル変数
 var testProperty = "test";
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?