SyntaxError: identifier starts immediately after numeric literal - JavaScript 编辑
Message
SyntaxError: identifier starts immediately after numeric literal (Firefox) SyntaxError: Unexpected number (Chrome)
Error type
What went wrong?
变量名叫identifiers,它符合某些规则,而你打破了这些规则!
一个JavaScript标识符必须以字母开头,下划线(_)或美元符号($)。他们不能以数字开头。只有后续字符可以是数字(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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论