gpt4 book ai didi

Javascript 文字表达式

转载 作者:行者123 更新时间:2023-11-30 11:46:06 25 4
gpt4 key购买 nike

“use strict” - 定义 JavaScript 代码应在严格模式下执行。

有没有其他类似"use strict";JavaScript文字表达式?

最佳答案

目前没有,不,"use strict"; 是唯一的。

规范称这些为“指令”。它们是“指令序言”的一部分。详情 in the spec :

Directive Prologues and the Use Strict Directive

A Directive Prologue is the longest sequence of ExpressionStatement productions occurring as the initial StatementListItem or ModuleItem productions of a FunctionBody, a ScriptBody, or a ModuleBody and where each ExpressionStatement in the sequence consists entirely of a StringLiteral token followed by a semicolon. The semicolon may appear explicitly or may be inserted by automatic semicolon insertion. A Directive Prologue may be an empty sequence.

A Use Strict Directive is an ExpressionStatement in a Directive Prologue whose StringLiteral is either the exact code unit sequences "use strict" or 'use strict'. A Use Strict Directive may not contain an EscapeSequence or LineContinuation.

A Directive Prologue may contain more than one Use Strict Directive. However, an implementation may issue a warning if this occurs.

关于Javascript 文字表达式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40927905/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com