Javascript:除了“use strict”之外,其他“使用”有指令吗? [英] Javascript: besides "use strict", which other "use" directives are there?

查看:96
本文介绍了Javascript:除了“use strict”之外,其他“使用”有指令吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

除了使用严格的,还有其他使用指令吗?

Besides use strict, which other use directives are there?

推荐答案

可以在指令序言(JavaScript引擎可能使用的部分)中的更多示例:

Some more examples that can be in the "directive prologue" (a section potentially usable by JavaScript engines):


  • 'use strict';

  • 'use asm';

    Mozilla的 asm.js 是该语言的一个子集,适用于对于数字运算。

  • '使用更严格';

    Google的SoundScript。对于快速OOP

    还有一些模式,如:

    • 'use strict';
    • 'use asm';
      Mozilla's asm.js is a subset of the language, geared towards crunching numbers.
    • 'use stricter';
      Google's SoundScript. For fast OOP
      Has also some modes like:
      • 'use stricter+types';
      • http://www.2ality.com/2015/02/soundscript.html

      推文< a href =https://twitter.com/jashkenas/status/562996829777059840\"rel =nofollow noreferrer> Jeremy Ashkenas 建议进一步使用 + - 前缀相同'使用...'; 字符串('使用更严格+ types -tco + jsx + asm + es2019-pre'; ),但这似乎与规范(在 kangax的答案中进一步澄清, Bergi的回答)。

      A tweet by Jeremy Ashkenas suggests some further use of + and - prefixes in the same 'use ...'; string ('use stricter +types -tco +jsx +asm +es2019-pre';), but that seems to contradict the spec (further clarified in kangax's answer and Bergi's answer).

      这篇关于Javascript:除了“use strict”之外,其他“使用”有指令吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆