“modo estrito” Respostas de código

JavaScript Modo Estrito em função

myVariable = 9;
console.log(myVariable); // 9

function hello() {

    // applicable only for this function
    'use strict';

    string = 'hello'; // throws an error
}

hello();
SAMER SAEID

modo estrito

Strict mode makes several changes to normal JavaScript semantics:
-Eliminates some JavaScript silent errors by changing them to throw errors.
-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.
-Prohibits some syntax likely to be defined in future versions of ECMAScript.
Owlthegentleman

Ligue o JS moderno, adicionando uso rigoroso ao seu script

// Non-strict code...

(function(){
  "use strict";

  // Define your library strictly...
})();

// Non-strict code... 
Aggressive Ant

Use javascript rigoroso

// File: myscript.js

'use strict';
var a = 2;
....
Repulsive Raven

Use javascript rigoroso

function doSomething() {
    'use strict';
    ...
}
Repulsive Raven

Respostas semelhantes a “modo estrito”

Perguntas semelhantes a “modo estrito”

Mais respostas relacionadas para “modo estrito” em JavaScript

Procure respostas de código populares por idioma

Procurar outros idiomas de código