SyntaxError: identifier starts immediately after numeric literal

이 문서는 아직 자원 봉사자들이 한국어로 번역하지 않았습니다. 참여해서 번역을 마치도록 도와 주세요!
English (US)의 문서도 읽어보세요.

Message

SyntaxError: identifier starts immediately after numeric literal (Firefox)
SyntaxError: Unexpected number (Chrome)

Error type

SyntaxError

What went wrong?

The names of variables, called identifiers, conform to certain rules, which your code must adhere to!

A JavaScript identifier must start with a letter, underscore (_), or dollar sign ($). They can't start with a digit! Only subsequent characters can be digits (0-9).

Examples

Variable names starting with numeric literals

Variable names can't start with numbers in JavaScript. The following fails:

var 1life = 'foo';
// SyntaxError: identifier starts immediately after numeric literal

var foo = 1life;
// SyntaxError: identifier starts immediately after numeric literal

You will need to rename your variable to avoid the leading number.

var life1 = 'foo';
var foo = life1;

See also

문서 태그 및 공헌자

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