语法错误:"0" 前缀的八进制文字和八进制转义序列。已弃用
仅 JavaScript 严格模式 例外“0 前缀的八进制文字和八进制转义序列已弃用;当使用已弃用的八进制文字和八进制转义序列时,会出现“对于八进制文字,请使用 "0°" 前缀”。
¥The JavaScript strict mode-only exception "0-prefixed octal literals and octal escape sequences are deprecated; for octal literals use the "0o" prefix instead" occurs when deprecated octal literals and octal escape sequences are used.
信息
¥Message
SyntaxError: Octal literals are not allowed in strict mode. (V8-based) SyntaxError: "0"-prefixed octal literals are deprecated; use the "0o" prefix instead (Firefox) SyntaxError: Decimal integer literals with a leading zero are forbidden in strict mode (Safari) SyntaxError: Octal escape sequences are not allowed in strict mode. (V8-based) SyntaxError: octal escape sequences can't be used in untagged template literals or in strict mode code (Firefox) SyntaxError: The only valid numeric escape in strict mode is '\0' (Safari)
错误类型
什么地方出了错?
¥What went wrong?
八进制文字和八进制转义序列已被弃用,并且在严格模式下会抛出 SyntaxError
。标准化语法使用前导零,后跟小写或大写拉丁字母 "O"(0o
或 0O
)。
¥Octal literals and octal escape sequences are deprecated and will throw a
SyntaxError
in strict mode. The
standardized syntax uses a leading zero followed by a lowercase or uppercase Latin
letter "O" (0o
or 0O
).
示例
"0" 前缀的八进制文字
八进制转义序列
有效的八进制数
也可以看看
¥See also