Home > Web Front-end > JS Tutorial > body text

JavaScript声明变量名的语法规则_javascript技巧

WBOY
Release: 2016-05-16 15:50:52
Original
1051 people have browsed it

一、语法规则

  1.变量必须使用字母、下划线(_)或者美元符($)开始。

  2.然后可以使用任意多个英文字母、数字、下划线(_)或者美元符($)组成。

  3.不能使用JS关键词与保留字。

二、示例  

  var score;
  score="100";

Copy after login

三、注意

  1.JS区分大小写。如变量score与Score是不一样的,相当两个变量。

  2.变量虽然可以不声明,直接使用,但不规范,会涉及变量名提升等问题。

以上所述就是本文的全部内容了,希望大家能够喜欢。

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!