Movatterモバイル変換


[0]ホーム

URL:


  1. 개발자를 위한 웹 기술
  2. JavaScript
  3. JavaScript 참고서
  4. JavaScript error reference
  5. SyntaxError: "0"-prefixed octal literals and octal escape seq. are deprecated

This page was translated from English by the community.Learn more and join the MDN Web Docs community.

View in EnglishAlways switch to English

SyntaxError: "0"-prefixed octal literals and octal escape seq. are deprecated

메시지

    SyntaxError: Octal numeric literals and escape characters not allowed in strict mode (Edge)    SyntaxError:    "0"-prefixed octal literals and octal escape sequences are deprecated;    for octal literals use the "0o" prefix instead

에러 타입

SyntaxErrorstrict mode 내에서만.

무엇이 잘 못 되었을까?

8진 리터럴과 8진수 이스케이프 시퀀스는 더 이상 사용하지 않으며, 엄격 모드(strict mode) 내에서는SyntaxError 에러를 던질 것입니다. ECMAScript 2015와 이 후의 버전의 표준화된 구문은 0을 맨 앞자리에 두고 그 뒤를 대문자 또는 소문자의 라틴 문자 "O" 를 사용하도록 합니다. (0o 또는0O)

예제

"0"이 접두인 8진 리터럴

js
"use strict";03;// SyntaxError: "0"-prefixed octal literals and octal escape sequences// are deprecated (0으로 시작하는 8진수와 8진 이스케이프 시퀀스는 더 이상 사용되지 않습니다. )

8진수 이스케이프 시퀀스

js
"use strict";"\251";// SyntaxError: "0"-prefixed octal literals and octal escape sequences// are deprecated (0으로 시작하는 8진수와 8진 이스케이프 시퀀스는 더 이상 사용되지 않습니다. )

유효한 8진 수들

0뒤에 "o" 또는 "O"를 사용합니다. :

js
0o3;

8진수 이스케이프 시퀀스 대신 16진수 이스케이프 시퀀스를 사용할 수도 있습니다. :

js
"\xA9";

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp