0

Привет... Какие отличия есть при использовании use strict ?

Одним с них ,который удалось найти

Пример 1:

function isStrictMode(){
    return !this;
} 
//returns false, since 'this' refers to global object and '!this' becomes false

function isStrictMode(){
"use strict"; return !this; }

alert(isStrictMode());

Пример 2:

"use strict";

function test() {
foo = "bar"; //ReferenceError: assignment to undeclared variable foo }

Можно посмотреть другие полезные примеры ,которые покажут разницу ?

SverxnovA
  • 1,805

1 Answers1

4

На MDN есть неплохая подборка примеров: MDN: Strict mode

Pavel Azanov
  • 6,734
  • 17
  • 31