本文介绍了哪个(javascript)环境支持ECMAscript 5严格模式? (又名“使用严格”)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

即将进入决赛我写这篇文章的草稿;它是由于包含一个严格模式,它将阻止您使用eval和其他限制分配给全局对象。 (是一个很好的介绍。)

ECMAScript 5 is in its final draft as I write this; It is due to include a strict mode which will prevent you from assigning to the global object, using eval, and other restrictions. (John Resig's Article is a good introduction.)

通过在文件(或函数)的顶部包含字符串use strict来触发这种神奇的保密模式。但是,在较旧的环境中,使用严格是一个无操作。如果你添加use strict并且不在严格的环境中测试它,那么你可能会留下一个非常严格的代码的定时炸弹,当它真正遇到严格的环境时会破坏。

This magical sanity-saving mode is triggered by including the string "use strict" at the top of your file (or function.) However, in older environments, "use strict" is a no-op. If you add "use strict" and don't test it in a strict environment, you could be leaving a time-bomb of not-really-strict code that will break when it really hits a strict environment.

哪些环境实际上尊重使用严格?

推荐答案

更新

查看我的。

原始回复

目前没有。

Raphael Speyer ,它在某些变体中模仿了严格模式的行为( Valija,Cajita等。

There's also Google's Caja project which somewhat emulates behavior of strict mode in some of its variations (Valija, Cajita, etc).

Crockford最近也将此选项添加到,但我不确定它是否实际触发了任何其他验证(根据ES5严格规则)。

Crockford also recently added this option to JSLint, but I'm not sure if it actually triggers any additional validations (as per ES5-strict rules).

这篇关于哪个(javascript)环境支持ECMAscript 5严格模式? (又名“使用严格”)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-09 23:32