Javascript: besides "use strict", what other "used" directives exist?

Besides use strict , what other use directives exist?

+4
source share
3 answers

A few more examples that might be in the "directory prolog" (a section potentially usable by JavaScript):

Twitter Jeremy Ashkenas suggests some use of the + and - prefixes on the same line of 'use ...'; ( 'use stricter +types -tco +jsx +asm +es2019-pre'; ), but this, apparently, contradicts spec (specified in kangax answer and Bergi ).

+1
source

If he is still interested in someone, I just came across the "use asm" directive, for use with asm.js.

So it seems that over time, additional "use" options may be added.

+3
source

Although it is not declarative, like "use strict"; , the next version of ECMAScript (codenamed Harmony) is likely to have an option that you can use in the <script> .

From this article :

  • select the MIME type in the script tag: <script type="application/javascript;version=next"> (where "next" is a placeholder for something that remains to be determined)

The article provides an overview of this presentation by David Herman , which is very worth a look.

+2
source

All Articles