Przetestowano kod js w Konsoli programowej Chrome i jestem nieco zdezorientowany.JavaScript 'use strict'; wewnątrz funkcji
Wiem, że w trybie ścisłym funkcje, które nie są metody obiektu, gdy mowa ten kluczowe powinny otrzymywać niezdefiniowanej zamiast globalnego obiektu.
function test(){
"use strict";
return this===undefined;}
test();
Wyjścia fałszywy.
"use strict";
function test(){
return this===undefined;}
test();
Wciąż fałszywy.
(function test(){
"use strict";
return this===undefined;}());
Wyjścia prawda.
Chciałem tylko wyjaśnić. ʕ • ᴥ • ʔ Jestem nowy w js.
proszę przeczytać podobne pytanie http://stackoverflow.com/questions/1335851/what-does-use-strict-do-in-javascript-and-what-is-the-reasoning-behind-it – hexblot
@hexblot nie odpowiada to jednak na pytanie ... – Christoph