What is Strict Mode in JavaScript?

Explanation about "use strict" in modern JavaScript
08 August 2017   1729
JavaScript

JavaScript is a lightweight interpreted or JIT-compiled programming language with first-class functions

What's Strict Mode in JS?

For a very long time the JavaScript language developed without loss of compatibility. New features were added to the language, but the old ones never changed, so as not to "break" the existing HTML / JS pages with their use.

However, this led to the fact that any mistake in the design of the language became "frozen in" it forever.

This was the case before the introduction of the ECMAScript 5 (ES5) standard, which simultaneously added new features and introduced a number of fixes to the language, which could lead to the fact that the old code that was written before it appeared will stop working.

To prevent this from happening, it was decided that by default these dangerous changes will be turned off and the code will work as before. And in order to translate the code into full compliance with the modern standard, you need to specify a special use strict directive.

Strict Mode is a feature that allows you to place a program, or a function, in a "strict" operating context. This strict context prevents certain actions from being taken and throws more exceptions.

Strict mode helps out in a couple ways:

  • It catches some common coding bloopers, throwing exceptions.
  • It prevents, or throws errors, when relatively "unsafe" actions are taken (such as gaining access to the global object).
  • It disables features that are confusing or poorly thought out.

Code example:

// Non-strict code...

(function(){
  "use strict";

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

// Non-strict code... 

At the moment, it supported by the most of the modern web browser, bar IE 9 and below. 

Also, note that it is impossible to cancel Strict Mode. 

Two things, where "use strict" can cause issues.

  1. Old browsers. IE9- browsers can display code with use strict with issues. 
  2. Libraries, that was written without use strict support. 

Conclusion

Write code with use strict only if you are sure that the problems described above will not appear.

Ethereum Services to be Under New Thread

At the moment, the vulnerability has already been fixed, hackers did not have time to use it
05 February 2019   330

Specialists from the blockchain-startup Parity Technologies have discovered a vulnerability in the JSONRPC protocol that threatens the security of the entire Ethereum ecosystem. In particular, MyEtherWallet, MyCrypto and Infura services are under threat of hacking.

At the moment, the problem has already been fixed, the attackers did not have time to use it.

The developers of Parity Technologies recommended that users update the nodes to the new software version in order to reduce the risk of losing access to decentralized applications.

Recall that in January, due to the critical vulnerability in improving the EIP-1283, which allows hackers to steal user funds, the hardfork network was postponed indefinitely
Ethereum Constantinople.