From da78a9e329e272dedb2400b79a3bdeebff387d47 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:42:17 -0500 Subject: initial commit --- .../errors/reserved_identifier/index.html | 80 ++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 files/ko/web/javascript/reference/errors/reserved_identifier/index.html (limited to 'files/ko/web/javascript/reference/errors/reserved_identifier') diff --git a/files/ko/web/javascript/reference/errors/reserved_identifier/index.html b/files/ko/web/javascript/reference/errors/reserved_identifier/index.html new file mode 100644 index 0000000000..8a1932d9cc --- /dev/null +++ b/files/ko/web/javascript/reference/errors/reserved_identifier/index.html @@ -0,0 +1,80 @@ +--- +title: 'SyntaxError: "x" is a reserved identifier' +slug: Web/JavaScript/Reference/Errors/Reserved_identifier +tags: + - 구문 에러 + - 예약어 + - 자바스크립트 +translation_of: Web/JavaScript/Reference/Errors/Reserved_identifier +--- +
{{jsSidebar("Errors")}}
+ +

메세지

+ +
SyntaxError: The use of a future reserved word for an identifier is invalid (Edge)
+SyntaxError: "x" is a reserved identifier (Firefox)
+SyntaxError: Unexpected reserved word (Chrome)
+ +

에러 타입

+ +

{{jsxref("SyntaxError")}}

+ +

무엇이 잘못되었을까?

+ +

예약어가 식별자로 쓰인 경우 발생하는 에러입니다. 이 키워드는 엄격(Strict) 모드와 느슨한(Sloppy) 모드에서 모두 예약어로 취급됩니다.

+ + + +

다음은 엄격 모드의 코드에서만 예약어로 취급됩니다:

+ + + +

예제

+ +

엄격 모드와 엄격하지 않은 모드에서의 예약어

+ +

enum 식별자는 일반적으로 예약되어 있습니다.

+ +
var enum = { RED: 0, GREEN: 1, BLUE: 2 };
+// SyntaxError: enum is a reserved identifier
+
+ +

엄격 모드의 코드에선 더 많은 식별자들이 예약되어 있습니다.

+ +
"use strict";
+var package = ["potatoes", "rice", "fries"];
+// SyntaxError: package is a reserved identifier
+
+ +

이 변수들의 이름을 변경해야 합니다.

+ +
var colorEnum = { RED: 0, GREEN: 1, BLUE: 2 };
+var list = ["potatoes", "rice", "fries"];
+ +

오래된 브라우저의 업데이트

+ +

새로운 구문을 사용하기 위해서는 최근 버전의 브라우저로 업데이트 해야 합니다. 예를 들어, 오래된 브라우저를 사용하고 있다면 let 또는 class 구현할 수 없습니다.

+ +
"use strict";
+class DocArchiver {}
+
+// SyntaxError: class is a reserved identifier
+// (오래된 버전의 브라우저에서만 에러가 발생합니다. 예) Firefox 44 이하)
+
+ +

같이 보기

+ + -- cgit v1.2.3-54-g00ecf