
本文共 3903 字,大约阅读时间需要 13 分钟。
JS���������������������������������������
���������JavaScript������������������������������������������������������������������������������������������������������������������������������������������������
���������������������
1.1 ������������������������������������
JavaScript������������������������number���string���boolean���null���undefined���symbol������������������������true���false���������������������������������������������������������������������������������������������������������������������������������������������
var a = 10;var b = a;a = 20;// ������b������������10������������������������
������������������������������Pointer���������������������������������������������������������������������������������������������������������������������������
var obj = new Object();var a = obj;var b = a;a.name = 'test';// ������b.name���������'test'���������������������������
1.2 dynamic properties
���������������������������person.name���������������������������������������������������������������������������������var person = new Object();person.name = 'sdf'; // ������������������var name = 'sdf';name.age = 23; �� �� �� // ���������������������������������������������undefined
1.3 ���������������
������������������������������������- ���������������������������������������
- ������������������������������������������������������������
���������
a = {age: 20};b = a; // b���a���������������������
1.4 ������������������
������typeof���������������������������instanceof������������������������������- typeof���null������'object'���������������������
- ������������instanceof������������������������:
console.log(person instanceof Object); // trueconsole.log([] instanceof Object); // trueconsole.log('/regex/. instanceof RegExp); // true
������������������
2.1 ������������������
������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������2.2 ������������������
������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������2.3 ������������������������������
JavaScript������������������������������������������������for loop���if statement���������������������������������������������������������������if (true) { var a = 1; // a���������������������������}
2.4 with������������
with������������������������������������������������������������������with(location) { var url = href + '?debug=true';}
���������url������������������������������������������
������������������
3.1 ������������������
JavaScript������������������������������������������������������������������������������������������������������������������������������������������������- ������������������������������
- ������CollectGarbage���pera.collect���������������������
3.2 ��� ���������������
������������������������������������������������������������������������a = new Object();a.waitFor������b = new Object();bonta]).para���// declar both a and b, and clear their references to avoid cycles
3.3 ������������������
- ���������������������null������������������
- ������������������var������������������������������������������
- ������������������������������������������������
������������������������
������������������������������������������������������������������������������������
������������������
- ������������������������������������������������
- ������������������������������������������������
- minimalista���������������������������������������
- ���������������������������������������������������
���������������������������������������JavaScript������������������������������������������������������������������������������
发表评论
最新留言
关于作者
