Home  >  Article  >  Web Front-end  >  Basic knowledge of JavaScript variables_Basic knowledge

Basic knowledge of JavaScript variables_Basic knowledge

WBOY
WBOYOriginal
2016-05-16 18:42:191071browse

1.区分大小写

   

   

2.弱类型变量

    全部的变量都用var关键字标示,JavaScript解释器会自动分配

3.句子的尾部分号是可选的

    如:var name=23; or var name=23都可以

   

   

4.代码可以嵌入在html中也可以引入js文件

   

   

    </span></p> <p align="left"><span style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体">    javascript</span></p> <p align="left"><span style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体">   

   

   

   

   

   

4.1 code can be imported directly from another file

For example: The result is the same

5. Multiple variables can be declared at the same time

For example: var name="JerryZhang",age=23,sex="male";

document.write(name "
" sex "
" age);

 

6.can not be initialized

such as : var name;

document.write(name);

 

7 Variable definitions cannot use keywords or reserved words (note: I don’t know what reserved words are)

For example: html, title, history are all OK, but document is not;

Such as : var html="asp.net";

document.write(html);

 

8. Variables in JavaScript can store multiple types of variables

For example: var i=23;

document.write(i "
");

i="JerryZhang";

document.write(i "
");

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