Skip to content

Commit 4eebb6e

Browse files
committed
pdf
1 parent d8926a8 commit 4eebb6e

364 files changed

Lines changed: 222 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
35.5 KB
Binary file not shown.
1.45 MB
Binary file not shown.
Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
js
2+
3+
һ���ʷ��ṹ
4+
1�����ִ�Сд
5+
2��ע�� // ���� /* ����ע�� */
6+
3��������(ֱ���� literal)
7+
12 //����
8+
5.8 // ��
9+
"hello"
10+
'hello'
11+
true
12+
/js/gi //����
13+
null //��
14+
{x:1,y:2}
15+
[1,2,3,4]
16+
4����ʾ��(����)�ͱ�����
17+
5���ֺſ���ʡ�Ե��ǿ��ܻ�������⣬js���Զ���;
18+
var y = x+f
19+
(a+b).toString()
20+
�ȼ���
21+
var y = x+f(a+b).toString();
22+
�������͡�ֵ�ͱ���
23+
1��ԭʼ���� ���֡��ַ����Ͳ��� null�� undefinedδ����
24+
2����������
25+
3���� Array Function Date RegExp Error
26+
4��js������ �������������
27+
5������js��ֵ������תΪ����ֵ
28+
undefined
29+
null
30+
0
31+
-0
32+
NaN
33+
"" ����ת��Ϊfalse
34+
6����װ����
35+
var s= "hello"; //ԭʼ���� ��û�з�����
36+
s.len = 4; //������ԭʼ���͵����Ի򷽷���ʱ��ԭʼ������û�����Ժͷ����ģ�
37+
//ֻҪ�������ַ��������Ի򷽷����ͻ����new String(s)��ԭʼ���ͣ���װ�ɶ���
38+
//�Ժ����s.len �ǵ���String��������Ժͷ�����һ�����ý������´�������ʱ���������
39+
var n = s.len; //��ʱΪundefined
40+
alert(n);
41+
42+
//�����ַ��� ���� ���ֵ����Ի򷽷�ʱ����������ʱ�����ǰ�װ����
43+
��ʾ�����װ���� var S = new String("hello")
44+
var s = "hello"; �Dz�ͬ��
45+
7��==��===
46+
8������ת��
47+
var n = 17;
48+
alert(n.toString(2)); //������ 10001
49+
alert(n.toString(8)); // 021
50+
alert(n.toString(16)); // 0x21
51+
alert(n.toString(10)); alert(n.toString());
52+
9��toString() valueOf()
53+
var date = new Date(2011,1,3);
54+
date.valueOf() ���غ�����������ʱ��
55+
10��js�Ƕ�̬���� var n = 10; ���������ڼ� �Ż�ȷ������������
56+
11������������
57+
�����������������ǰ
58+
�����ڶ���ı��� �����Զ���ǰ����������
59+
12����������scope chain
60+
�ڲ����������ĺ������ڣ������������������󣬵�һ���Ƕ��庯��
61+
�����;ֲ������Ķ��󣬵ڶ�����ȫ�ֶ���
62+
��һ��Ƕ�׺������ڣ�������������������������
63+
64+
����һ������ʱ����������һ���������������ú���ʱ��������һ��
65+
�µĶ���洢���ľֲ���������������������ӵ�������Ǹ���������
66+
�ϣ�ͬʱ����һ���µĸ����ı�ʾ��������������ġ�����������Ƕ�׺���
67+
ÿ�ε����ⲿ����ʱ���ڲ����������¶���һ�顣ÿ�ε����ⲿ������ʱ��
68+
���������Dz�ͬ�ġ�
69+
13��delete in eval void
70+
71+
������ ���
72+
73+
������ ����
74+
1������������� create set query delete test enumerate
75+
2��������������� ��д ��ö�� �����ã��Ƿ��ɾ����
76+
3�������������
77+
�����ԭ�� prototype
78+
������� ��ʾ�������͵��ַ���
79+
�������չ��� �Ƿ������������
80+
//������������ַ���
81+
4������ֱ����
82+
var empty = {};
83+
var point = {x:0,y:0};
84+
5��new��������
85+
var o = new Object(); //�ն��� ��{}һ��
86+
var a = new Array();
87+
6��Object.create()
88+
var o1 = Object.create({x:1,y:2}); //o1 �̳��Զ���ԭ��{x:1,y:2}
89+
var o2 = Object.create(null); //o2���̳��κ����Ժͷ���
90+
var o3 = Object.create(Object.prototype);
91+
//�ն���� {} new Object()һ��
92+
7�����ԵIJ��� ��Ϊ��������Ķ���
93+
object.property
94+
object["property"] ɢ�� ӳ�� �ֵ� ��������
95+
8���̳�
96+
js�ļ̳�ֻ�ܴӸ����ȡ���Ե�ֵ���������޸�ԭ����
97+
�������bookΪnull��undefined
98+
book.subtitle.length�ᱨ��
99+
�������
100+
var len = book && book.subtitle && book.subtitle.length;
101+
102+
ɾ������
103+
delete book.subtitle
104+
105+
������� in hasOwnPreperty() propertyIsEnumerable()
106+
var o = {x:1};
107+
"x" in o
108+
"toString" in o
109+
110+
hasOwnPreperty();�ж������Ƿ����Լ��ġ��̳����Է���false
111+
112+
propertyIsEnumerable() ֻ�����������ԣ�����ö��
113+
114+
115+
��ȡ��������
116+
Object.keys()
117+
Object.getOwnPropertyNames()
118+
9������getter��setter
119+
var o = {
120+
x: 0,
121+
y: 1,
122+
set r(value) { value = this.r;},
123+
get r() { return this.x + this.y;}
124+
};
125+
x�������ԣ�r��ȡ������
126+
10�����Ե����� ecmascript5 �ϵ�ie��֧�������÷�
127+
�������Ե����ԣ�ֵvalue ��д��writable
128+
��ö��enumerable
129+
������configurable
130+
��ȡ���������ԣ�get set
131+
��ö��enumerable
132+
������configurable
133+
//����{value:1,writable:true,emunerable:true,configurable:true}
134+
Object.getOwnPropertyDescriptor({x:1},x)
135+
//�鲻������ ����undefined
136+
137+
�������Ե����� �����޸ļ̳е���������
138+
Object.defineProperty()
139+
//���ò���ö������
140+
var o = {};
141+
Object.defineProperty(o,"x",{
142+
value:1,
143+
writable:true,
144+
emunerable:false,
145+
configurable:true
146+
})
147+
148+
//����ֻ��
149+
Object.defineProperty(o,"x",{writable:false})
150+
151+
�޸Ķ����������
152+
Object.defineProperties()
153+
154+
��չObject.prototype �� P137
155+
11���������������
156+
prototype class extensible attribute
157+
158+
��ѯ�����ԭ��
159+
ecmascript5�� Object.getPrototypeOf(o1)
160+
ecmascript3�� o1.constructor.prototype
161+
162+
ͨ������ֱ������new Object()��ʽ�����Ķ���
163+
����һ��constructor�����ԣ�ָObject()�Ĺ��캯��
164+
constructor.prototype����������ԭ��
165+
166+
p.isPrototypeOf(o)������p�Ƿ���o��ԭ��
167+
168+
169+
//��ȡ��������� �ַ���
170+
Object.prototype.toString.call(o1).slice(8,-1)
171+
12������Ŀ���չ��
172+
�����Ƿ�����¼�����
173+
Object.preventExtensions() ���ö��󲻿���չ
174+
Object.isExtensible()
175+
Object.seal() ���˽���������Ϊ������չ��������������Ϊ��������
176+
Object.freeze()
177+
���˽���������Ϊ������չ������������Ϊ�������ã�������������Ϊֻ��
178+
179+
��8�� ����
180+
1�����������������
181+
function t(){ }
182+
t(); �������� this��ȫ�ֶ��� �ϸ�ģʽ����undefined
183+
184+
var o = {a:function(){}};
185+
o.a() �������� this�ǵ�ǰ���õĶ���
186+
2�����캯������
187+
var o = new Object(); var o= new Object;
188+
o�̳��Թ��캯����prototype���� �ڲ���this�Ǵ˶���
189+
190+
var r = new o.m();�е�this����o
191+
3��P184 ������ִ���õ�������������������������Ǻ��������ʱ�򴴽��ġ�
192+
Ƕ�׵ĺ���f()���������������������еı���scope�Ǿֲ�����
193+
194+
195+
��������
196+
197+
����s()����������s��ִ�л���(���ö���),�����ö�������������ͷ��
198+
Ȼ�󽫺���t�ĵ��ö���������֮�������ȫ�ֶ���Ȼ���������ͷѰ�ұ���name
199+
200+
����ss() ss() ==> t() ==> window
201+
name="lwy";
202+
function t(){
203+
var name="tlwy";
204+
function s(){
205+
var name="slwy";
206+
console.log(name);
207+
}
208+
function ss(){
209+
console.log(name);
210+
}
211+
s();
212+
ss();
213+
}
214+
t();
215+
216+
ÿ�ε��ú�������������һ���µ����������������µ��ڲ�����
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)