4.1 String literal
1. String literal
. Can be 0 or more.
. Strings must be written on the same line. If it is too long, use the symbol
. The double quotes and single quotes used to delimit the beginning and end must match
2. Escape characters in strings
转义字符 |
所代表的字符 |
' |
单引号 |
" |
双引号 |
\ |
反斜杠 |
b |
退格符 |
f |
换页符 |
n |
换行符 |
r |
回车符 |
t |
水平制表符 |
v |
垂直制表符 |
xXX |
由2位十六进制(xx)指定的latin-1字符 |
XXX |
由1位到3位的八进制(1-377)指定的latin-1字符 |
UXXXX |
由4位十六进制数(xxxx)指定的unicode字符 |
4.2 Digital direct quantity
1. Integer direct quantity var a=10;
1. Decimal integer
2 The first digit of the octal integer must be 0, 02, 0123, 047, Note: ECMAScript Not supported
3 Hexadecimal integers starting with ox or 0x, ox123, ox12AF
2. Floating point direct quantity
1. Traditional notation 12.345.2943 0.38
2. Scientific notation Method 1.23e4=1.23x103=1230
4.3 Boolean direct quantity
4.4 Array direct quantity
var myarr=["my string",,123,];
4.5 Function direct quantity
function (Parameter list){Statement block in function}
var myFunction=Function(a,b){return a b};
4.6 Object direct quantity
{Attribute name 1: attribute value 1, attribute name 2 : Attribute value 2, attribute name 3, attribute value 3....}
var myobj={height:10,width:20,name:"box"};
4.7 Special direct quantity
1.null direct quantity
var my=null;
2.undefined direct quantity
var mynumber=123;
document.writer(mynumber);
mynumber=undefined;
document .writer(mynumber);//Equivalent to the unassigned state
4.8 Character set
Javascript uses the Unicode character set
1. Unicode character set
For developers who do not belong to the English language , using the Unicode character set is a very important thing