JS学习代码笔记

JavaScript学习笔记1 语法结构

2017-03-13  本文已影响0人  RichardW

字符集

  1. 使用Unicode
console.info('\u0020');//空格符
console.info('\u000C');//换页符
console.info('\u000D');//回车符
console.info('\u000A');//换行符
console.info("caf \u00e9");//cafe

注释

//注释...
/*注释*/

直接量(可以直接使用的数据值)

1.2,12 //数字
'字符串',"字符串"
true,false,
/javascript/gi //正则表达式直接量
null 空
{...} 对象
[...] 数组

标识符

必须以字母,下划线或者$开头

保留字

第一组(必须保留字)
break do instanceof typeof case else new var catch finally return void continue for switch while debugger function this with default if throw delete in try
第二组(ECMA5中的保留字)
class enum extends super const export import
第三组(ECMA3中的保留字)
abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public
第四组(严格模式下的保留字)
implements package public interface private static let protected yield

var a
a
=
3
//等价于
var a; a = 3;
return
true
//等价于
return;
true;
x
++
y
//等价于
x;
++y;
上一篇 下一篇

猜你喜欢

热点阅读