“mode strict” Réponses codées

mode strict javascript en fonction

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

function hello() {

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

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

hello();
SAMER SAEID

mode strict

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

Allumez JS moderne en ajoutant une utilisation stricte à votre script

// Non-strict code...

(function(){
  "use strict";

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

// Non-strict code... 
Aggressive Ant

Utilisez un javascript strict

// File: myscript.js

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

Utilisez un javascript strict

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

Réponses similaires à “mode strict”

Questions similaires à “mode strict”

Plus de réponses similaires à “mode strict” dans JavaScript

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code