Home  >  Article  >  Web Front-end  >  JavaScript 变量命名规则_基础知识

JavaScript 变量命名规则_基础知识

WBOY
WBOYOriginal
2016-05-16 18:46:051376browse

JScript 是一种区分大小写的语言。

第一个字符必须是一个 ASCII 字母(大小写均可),或一个下划线(_)。注意第一个字符不能是数字。
后续的字符必须是字母、数字或下划线。
变量名称一定不能是 保留字。

下面给出合法变量名称的一些示例:
_pagecount Part9 Number_Items 下面给出无效变量名称的一些示例:

99Balloons // 不能以数字开头。Smith&Wesson // “与”符号(&)字符用于变量名称是无效的。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn