Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

SyntaxError: Unexpected token

이 글은 편집 검토가 필요합니다. 도울을 줄 수 있는 방법을 살펴보세요.

현재 번역은 완벽하지 않습니다. 한국어로 문서 번역에 동참해주세요.

메시지

SyntaxError: expected expression, got "x"
SyntaxError: expected property name, got "x" 
SyntaxError: expected target, got "x"
SyntaxError: expected rest argument name, got "x"
SyntaxError: expected closing parenthesis, got "x"
SyntaxError: expected '=>' after argument list, got "x"

에러 타입

SyntaxError

무엇이 잘못되었나요?

특정 언어 구조를 예상했지만 무언가 다른 것이 있었습니다. 아마도, 간단한 오타일 것입니다.

예제

예상하지 못한 표현식

예를 들어, 함수를 호출할 때, 인수에서 마지막 부분에 콤마는 허용되지 않습니다. 자바스크립트는 계속해서 다른 인자가 있을 것이라고 기대하기 때문입니다.

Math.max(2, 42,);
// SyntaxError: expected expression, got ')'

콤마를 생략하거나 다른 인수를 추가해 수정할 수 있습니다.

Math.max(2, 42);
Math.max(2, 42, 13+37);

참조

문서 태그 및 공헌자

 이 페이지의 공헌자: ChangSungsil
 최종 변경: ChangSungsil,