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

์—๋Ÿฌ ํƒ€์ž…

SyntaxError strict mode ๋‚ด์—์„œ๋งŒ.

๋ฌด์—‡์ด ์ž˜ ๋ชป ๋˜์—ˆ์„๊นŒ?

8์ง„ ๋ฆฌํ„ฐ๋Ÿด๊ณผ 8์ง„์ˆ˜ ์ด์Šค์ผ€์ดํ”„ ์‹œํ€€์Šค๋Š” ๋” ์ด์ƒ ์‚ฌ์šฉํ•˜์ง€ ์•Š์œผ๋ฉฐ, ์—„๊ฒฉ ๋ชจ๋“œ(strict mode) ๋‚ด์—์„œ๋Š” SyntaxError ์—๋Ÿฌ๋ฅผ ๋˜์งˆ ๊ฒƒ์ž…๋‹ˆ๋‹ค. ECMAScript 2015์™€ ์ด ํ›„์˜ ๋ฒ„์ „์˜ ํ‘œ์ค€ํ™”๋œ ๊ตฌ๋ฌธ์€ 0์„ ๋งจ ์•ž์ž๋ฆฌ์— ๋‘๊ณ  ๊ทธ ๋’ค๋ฅผ ๋Œ€๋ฌธ์ž ๋˜๋Š” ์†Œ๋ฌธ์ž์˜ ๋ผํ‹ด ๋ฌธ์ž "O" ๋ฅผ ์‚ฌ์šฉํ•˜๋„๋ก ํ•ฉ๋‹ˆ๋‹ค. (0o ๋˜๋Š” 0O)

์˜ˆ์ œ

"0"์ด ์ ‘๋‘์ธ 8์ง„ ๋ฆฌํ„ฐ๋Ÿด

"use strict";

03;

// SyntaxError: "0"-prefixed octal literals and octal escape sequences
// are deprecated (0์œผ๋กœ ์‹œ์ž‘ํ•˜๋Š” 8์ง„์ˆ˜์™€ 8์ง„ ์ด์Šค์ผ€์ดํ”„ ์‹œํ€€์Šค๋Š” ๋” ์ด์ƒ ์‚ฌ์šฉ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. )

8์ง„์ˆ˜ ์ด์Šค์ผ€์ดํ”„ ์‹œํ€€์Šค

"use strict";

"\251";

// SyntaxError: "0"-prefixed octal literals and octal escape sequences
// are deprecated (0์œผ๋กœ ์‹œ์ž‘ํ•˜๋Š” 8์ง„์ˆ˜์™€ 8์ง„ ์ด์Šค์ผ€์ดํ”„ ์‹œํ€€์Šค๋Š” ๋” ์ด์ƒ ์‚ฌ์šฉ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. )

์œ ํšจํ•œ 8์ง„ ์ˆ˜๋“ค

0๋’ค์— "o" ๋˜๋Š” "O"๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. :

0o3;

8์ง„์ˆ˜ ์ด์Šค์ผ€์ดํ”„ ์‹œํ€€์Šค ๋Œ€์‹  16์ง„์ˆ˜ ์ด์Šค์ผ€์ดํ”„ ์‹œํ€€์Šค๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค. :

'\xA9';

See also