-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjsnotes.html
927 lines (442 loc) · 51.5 KB
/
jsnotes.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
<!DOCTYPE html>
<html class="theme-next gemini use-motion" lang="zh-Hans">
<head>
<meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="theme-color" content="#222">
<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />
<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />
<link href="/css/main.css?v=5.1.4" rel="stylesheet" type="text/css" />
<link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=5.1.4">
<link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=5.1.4">
<link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=5.1.4">
<link rel="mask-icon" href="/images/logo.svg?v=5.1.4" color="#222">
<meta name="keywords" content="Hexo, NexT" />
<meta name="description" content="JS变量 类型 a、值类型:Number、String、Boolean、Null、Undefined、Symbol(ECMAScript中定义) 存在栈中(占据空间固定,按值访问) b、引用类型:Object、Array、Function等 存在堆中(值大小会变化,变量存储的是其指针) 1234567891011121314//对象深度复制问题window.deepClone = func">
<meta property="og:type" content="article">
<meta property="og:title" content="JS笔记">
<meta property="og:url" content="http://wwilll.github.io/jsnotes.html">
<meta property="og:site_name" content="LeoBlog">
<meta property="og:description" content="JS变量 类型 a、值类型:Number、String、Boolean、Null、Undefined、Symbol(ECMAScript中定义) 存在栈中(占据空间固定,按值访问) b、引用类型:Object、Array、Function等 存在堆中(值大小会变化,变量存储的是其指针) 1234567891011121314//对象深度复制问题window.deepClone = func">
<meta property="og:locale" content="zh-Hans">
<meta property="og:updated_time" content="2018-04-16T15:33:44.678Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="JS笔记">
<meta name="twitter:description" content="JS变量 类型 a、值类型:Number、String、Boolean、Null、Undefined、Symbol(ECMAScript中定义) 存在栈中(占据空间固定,按值访问) b、引用类型:Object、Array、Function等 存在堆中(值大小会变化,变量存储的是其指针) 1234567891011121314//对象深度复制问题window.deepClone = func">
<script type="text/javascript" id="hexo.configurations">
var NexT = window.NexT || {};
var CONFIG = {
root: '/',
scheme: 'Gemini',
version: '5.1.4',
sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
fancybox: true,
tabs: true,
motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
duoshuo: {
userId: '0',
author: '博主'
},
algolia: {
applicationID: '',
apiKey: '',
indexName: '',
hits: {"per_page":10},
labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
}
};
</script>
<link rel="canonical" href="http://wwilll.github.io/jsnotes.html"/>
<title>JS笔记 | LeoBlog</title>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-117115269-1', 'auto');
ga('send', 'pageview');
</script>
<script type="text/javascript">
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?3e63d3af22bfe81b38975277f2eadd22";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
</head>
<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">
<div class="container sidebar-position-left page-post-detail">
<div class="headband"></div>
<a href="https://github.com/wwilll" class="github-corner" aria-label="View source on Github"><svg width="80" height="80" viewBox="0 0 250 250" style="fill:#151513; color:#fff; position: absolute; top: 0; border: 0; right: 0;" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a><style>.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}</style>
<header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
<div class="header-inner"><div class="site-brand-wrapper">
<div class="site-meta ">
<div class="custom-logo-site-title">
<a href="/" class="brand" rel="start">
<span class="logo-line-before"><i></i></span>
<span class="site-title">LeoBlog</span>
<span class="logo-line-after"><i></i></span>
</a>
</div>
<p class="site-subtitle">个人博客</p>
</div>
<div class="site-nav-toggle">
<button>
<span class="btn-bar"></span>
<span class="btn-bar"></span>
<span class="btn-bar"></span>
</button>
</div>
</div>
<nav class="site-nav">
<ul id="menu" class="menu">
<li class="menu-item menu-item-home">
<a href="/" rel="section">
<i class="menu-item-icon fa fa-fw fa-home"></i> <br />
首页
</a>
</li>
<li class="menu-item menu-item-tags">
<a href="/tags/" rel="section">
<i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
标签
</a>
</li>
<li class="menu-item menu-item-categories">
<a href="/categories/" rel="section">
<i class="menu-item-icon fa fa-fw fa-th"></i> <br />
分类
</a>
</li>
<li class="menu-item menu-item-archives">
<a href="/archives/" rel="section">
<i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
归档
</a>
</li>
</ul>
</nav>
</div>
</header>
<main id="main" class="main">
<div class="main-inner">
<div class="content-wrap">
<div id="content" class="content">
<div id="posts" class="posts-expand">
<article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
<div class="post-block">
<link itemprop="mainEntityOfPage" href="http://wwilll.github.io/jsnotes.html">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="name" content="Leo">
<meta itemprop="description" content="">
<meta itemprop="image" content="/images/1.jpg">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="LeoBlog">
</span>
<header class="post-header">
<h1 class="post-title" itemprop="name headline">JS笔记</h1>
<div class="post-meta">
<span class="post-time">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">发表于</span>
<time title="创建于" itemprop="dateCreated datePublished" datetime="2018-04-15T13:27:31+08:00">
2018-04-15
</time>
</span>
<span class="post-category" >
<span class="post-meta-divider">|</span>
<span class="post-meta-item-icon">
<i class="fa fa-folder-o"></i>
</span>
<span class="post-meta-item-text">分类于</span>
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
<a href="/categories/前端-JS/" itemprop="url" rel="index">
<span itemprop="name">前端-JS</span>
</a>
</span>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<h1 id="JS变量"><a href="#JS变量" class="headerlink" title="JS变量"></a>JS变量</h1><ul>
<li><p><strong>类型</strong><br> a、值类型:Number、String、Boolean、Null、Undefined、Symbol(ECMAScript中定义)</p>
<pre><code>存在栈中(占据空间固定,按值访问)
</code></pre><p> b、引用类型:Object、Array、Function等</p>
<pre><code>存在堆中(值大小会变化,变量存储的是其指针)
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">//对象深度复制问题</span><br><span class="line">window.deepClone = function(obj){</span><br><span class="line"> var newobj = obj.constructor === Array ? [] : {};</span><br><span class="line"> if(typeof obj !== 'object'){</span><br><span class="line"> return obj;</span><br><span class="line"> } else if(window.JSON){</span><br><span class="line"> newobj = JSON.parse(JSON.stringify(obj));</span><br><span class="line"> } else {</span><br><span class="line"> for(var i in obj){</span><br><span class="line"> newobj[i] = typeof obj[i] === 'object' ? deepClone(obj[i]) : obj[i]; </span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> return newobj;</span><br><span class="line">};</span><br></pre></td></tr></table></figure>
</code></pre><p> c、判断</p>
<pre><code>1、typeof [{},[],null,new Function(),new Date()] // object
能有效判断string,number,symbol,boolean,undefined,function
2、A instanceof B 判断A是否B的实例
[] instanceof Array; //true
[] instanceof Object; //true
注意网页中多个框架(iframe)情况,各自有不同的构造函数
ES5提供了Array.isArray(arr)方法确认某个对象本身是否为Array类型
3、constructor 在Fn的prototype属性下并指向Fn本身(只能函数和其直接构造函数)
null,undefined不存在constructor,
constructor不稳定,当重写prototype后,原有的constructor引用会丢失,constructor会默认为Object
var f = new F();
f.constructor === F //true 因为f是F的实例,F.prototype上的constructor传递到了f上
4、toString
对于Object对象,直接调用toString(),就能返回字符串[object Object],其他需要用call/apply
Object.prototype.toString() ; // [object Object]
Object.prototype.toString.call('') ; // [object String]
Object.prototype.toString.call(new RegExp()) ; // [object RegExp]
Object.prototype.toString.call(document) ; // [object HTMLDocument]
Object.prototype.toString.call(window) ; //[object global] window 是全局对象global的引用
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">function type(sth){</span><br><span class="line"> var ty=Object.prototype.toString.call(sth);</span><br><span class="line"> var res=ty.slice(8,ty.length-1);</span><br><span class="line"> return res;</span><br><span class="line">}</span><br><span class="line">var o={};</span><br><span class="line">var arr=[1,2];</span><br><span class="line">console.log(type(o)); // Object 实测object也可调用call判断</span><br><span class="line">console.log(type(arr)); // Array</span><br></pre></td></tr></table></figure>
</code></pre><p> d、<a href="https://www.cnblogs.com/onepixel/p/5126046.html" target="_blank" rel="noopener">原文链接</a>参考</p>
</li>
<li><p><strong>计算</strong><br> 强制类型转换</p>
<pre><code><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line">//字符串拼接</span><br><span class="line">var a=10+10 // 20</span><br><span class="line">var b=10+'10' // 1010</span><br><span class="line">//==</span><br><span class="line">100 == '100' // true</span><br><span class="line">0 == '' // true</span><br><span class="line">null == undefined //true</span><br><span class="line">//if判断(除以下六种情况,全部转换为true)</span><br><span class="line">if(undefined || null || 0 || NaN || '' || false){</span><br><span class="line"> alert(true);</span><br><span class="line">}</span><br><span class="line"></span><br><span class="line">// === 和 == 使用,除以下情况外,尽量全部用 ===</span><br><span class="line">if(obj.a == null){</span><br><span class="line"> //jquery源码写法,相当于(obj.a === null || obj.a === undefined)</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
</code></pre></li>
<li><p><strong>JS内置函数及对象</strong><br> 函数:Object,Array,Boolean,Number,String,Function,Date,RegExp,Error等<br> 对象:JSON,Math</p>
<pre><code>JSON.stringify({a:10,b:20}) //对象转字符串
JSON.parse('{"a":10,"b":20}') //字符串转对象
</code></pre><p> 数组API:</p>
<pre><code>forEach 遍历所有元素
every 判断所有元素是否都符合条件
some 判断是否有元素符合条件
sort 排序
map 对元素重新组装,生成新数组
filter 过滤符合条件的元素
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br></pre></td><td class="code"><pre><span class="line">var arr = [1,3,2];</span><br><span class="line">arr.forEach(function(item,index){</span><br><span class="line"> console.log(index,item);</span><br><span class="line">})</span><br><span class="line">var res = arr.every(function(item,index){</span><br><span class="line"> if(item < 4){</span><br><span class="line"> return ture; //若所有元素都小于4,返回true</span><br><span class="line"> }</span><br><span class="line">})</span><br><span class="line">console.log(res); //true</span><br><span class="line">var res = arr.some(function(item,index){</span><br><span class="line"> if(item < 2){</span><br><span class="line"> return ture; //若有元素小于2,返回true</span><br><span class="line"> }</span><br><span class="line">})</span><br><span class="line">console.log(res); //true</span><br><span class="line">arr.sort(function(a,b){ //此方法会改变自身</span><br><span class="line"> //从小到大(默认)</span><br><span class="line"> return a - b;</span><br><span class="line"> //从大到小</span><br><span class="line"> //return b - a;</span><br><span class="line">})</span><br><span class="line">console.log(arr); //[1,2,3]</span><br><span class="line">var arrm = arr.map(function(item,index){ //此方法返回新数组,原数组不变</span><br><span class="line"> return '<h1>' + item + '</h1>';</span><br><span class="line">})</span><br><span class="line">console.log(arr); //[1,2,3]</span><br><span class="line">console.log(arrm); //["<h1>1</h1>","<h1>2</h1>","<h1>3</h1>"]</span><br><span class="line">var arrf = arr.filter(function(item,index){ //此方法返回新数组,原数组不变</span><br><span class="line"> if(item >= 2){</span><br><span class="line"> return true;</span><br><span class="line"> }</span><br><span class="line">})</span><br><span class="line">console.log(arr); //[1,2,3]</span><br><span class="line">console.log(arrf); //[2,3]</span><br></pre></td></tr></table></figure>
</code></pre><p> 对象API:</p>
<pre><code><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">var obj = {</span><br><span class="line"> x:1,</span><br><span class="line"> y:2,</span><br><span class="line"> z:3</span><br><span class="line">}</span><br><span class="line">var key;</span><br><span class="line">for(key in obj){</span><br><span class="line"> if(obj.hasOwnProperty(key)){</span><br><span class="line"> console.log(key,obj[key]);</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
</code></pre></li>
</ul>
<h1 id="原型"><a href="#原型" class="headerlink" title="原型"></a>原型</h1><ul>
<li><p><strong>构造函数</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">function Foo(name){ //构造函数一般大写</span><br><span class="line"> this.name = name;</span><br><span class="line"> this.other = 'otherAttr';</span><br><span class="line"> // return this //默认有此行</span><br><span class="line">}</span><br><span class="line">var f = new Foo('zhangsan');</span><br><span class="line">//new Foo()的时候,Foo里面的this变为空对象,属性赋值后返回this(this指向创建的新对象f)</span><br><span class="line">f instanceof Foo //判断f的直接构造函数是否为Foo</span><br></pre></td></tr></table></figure>
</li>
<li><p><strong>原型规则</strong><br> 所有引用类型(数组,对象,函数),都有对象特性:可自由扩展属性<br> 所有引用类型(数组,对象,函数),都有__proto__属性:属性值是普通对象<br> 所有的函数,都有一个prototype属性:属性值是普通对象<br> 所有引用类型(数组,对象,函数),__proto__属性值指向它的构造函数的”prototype”属性值<br> 当试图得到一个对象的某个属性时,如果这个对象本身没有这个属性,那么会去它的__proto__(即它构造函数的prototype)中找</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br></pre></td><td class="code"><pre><span class="line">循环遍历自身属性</span><br><span class="line">var item;</span><br><span class="line">for(item in foo){</span><br><span class="line"> //高级浏览器已经在for in中屏蔽了来自原型的属性,但还是建议加上以下判断</span><br><span class="line"> if(foo.hasOwnProperty(item)){</span><br><span class="line"> console.log(item);</span><br><span class="line"> }</span><br><span class="line">}</span><br><span class="line">//原型继承实例,封装DOM查询</span><br><span class="line">function Emt(id){</span><br><span class="line"> this.emt = document.getElementById(id);</span><br><span class="line">}</span><br><span class="line">Emt.prototype.html = function(val){</span><br><span class="line"> var emt = this.emt;</span><br><span class="line"> if(val){</span><br><span class="line"> emt.innerHTML = val;</span><br><span class="line"> return this //此句可用于链式操作</span><br><span class="line"> }else{</span><br><span class="line"> return emt.innerHTML;</span><br><span class="line"> }</span><br><span class="line">}</span><br><span class="line">Emt.prototype.on = function(type,fn){</span><br><span class="line"> var emt = this.emt;</span><br><span class="line"> emt.addEventListener(type,fn);</span><br><span class="line"> return this //此句表示其后还可跟链式调用</span><br><span class="line">}</span><br><span class="line">var div1 = new Emt('div1');</span><br><span class="line">//console.log(div1.html());</span><br><span class="line">//链式操作</span><br><span class="line">div1.html('<h1>Hello</h1>').on('type',function(){</span><br><span class="line"> alert('clicked');</span><br><span class="line">})</span><br></pre></td></tr></table></figure>
</li>
</ul>
<h1 id="作用域和闭包"><a href="#作用域和闭包" class="headerlink" title="作用域和闭包"></a>作用域和闭包</h1><ul>
<li><p><strong>执行上下文</strong><br> 范围:一段< script>或一个函数<br> 全局:变量定义、函数声明 (一段< script>)<br> 函数:变量定义、函数声明、this、arguments (函数)<br> 执行前,变量定义和函数声明被提前,this要在执行时才能确认</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">var a = {</span><br><span class="line"> name:'A';</span><br><span class="line"> fn:function(){</span><br><span class="line"> console.log(this.name);</span><br><span class="line"> }</span><br><span class="line">}</span><br><span class="line">a.fn() //this === a</span><br><span class="line">a.fn().call({name:'B'}) //this ==={name:'B'}</span><br><span class="line">var fn1 = a.fn</span><br><span class="line">fn1() // this === window</span><br></pre></td></tr></table></figure>
<p> this:作为构造函数执行,作为对象属性执行,作为普通函数执行(window),call apply bind</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">//call,apply,bind都能改变this指向(bind必须用函数表达式形式)</span><br><span class="line">var fn2 = function(name){</span><br><span class="line"> alert(name);</span><br><span class="line"> console.log(this) //this === {y:20}</span><br><span class="line">}.bind({y:20})</span><br><span class="line">fn2('zhangsan')</span><br></pre></td></tr></table></figure>
</li>
<li><p><strong>作用域</strong><br> 无块级,只有函数和全局作用域</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">if(true){</span><br><span class="line"> var name = 'zhangsan'; //name不属于if代码块私有,在if外面能访问到此变量</span><br><span class="line">}</span><br><span class="line">console.log(name) //zhangsan</span><br><span class="line">var a = 100; //全局变量</span><br><span class="line">var b = 200;</span><br><span class="line">function fn(){</span><br><span class="line"> var a = 200; //函数内部变量,与全局变量a互不影响</span><br><span class="line"> console.log('fn',a); // fn 200</span><br><span class="line"> //b在此函数作用域中未定义(会去父级作用域找),它是自由变量</span><br><span class="line"> console.log(b); // 200</span><br><span class="line">}</span><br><span class="line">console.log('global',a); // global 100</span><br><span class="line">fn();</span><br></pre></td></tr></table></figure>
</li>
<li><p><strong>闭包</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line">//函数作为返回值</span><br><span class="line">function F1(){</span><br><span class="line"> var a = 100;</span><br><span class="line"> return function(){</span><br><span class="line"> console.log(a); //100</span><br><span class="line"> }</span><br><span class="line">}</span><br><span class="line">var f1 = F1();</span><br><span class="line">var a = 200;</span><br><span class="line">f1(); //100</span><br><span class="line">//函数作为参数传递</span><br><span class="line">function F2(fn){</span><br><span class="line"> var a = 200;</span><br><span class="line"> fn();</span><br><span class="line">}</span><br><span class="line">F2(f1); //100</span><br></pre></td></tr></table></figure>
</li>
<li><p><strong>异步和单线程</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">//同步会阻塞程序运行(区别与异步)</span><br><span class="line">console.log(1);</span><br><span class="line">alert(2); //程序在此卡住,什么时候点击,什么时候继续</span><br><span class="line">console.log(3)</span><br><span class="line">//异步不会阻塞</span><br><span class="line">console.log(1);</span><br><span class="line">setTimeout(function(){ //程序跳过定时任务,继续执行后面代码,空闲时提出来执行</span><br><span class="line"> console.log(2);</span><br><span class="line">},1000)</span><br><span class="line">console.log(3);</span><br></pre></td></tr></table></figure>
<p> 单线程特点:一次只能干一件事<br> 在可能发生等待的情况并且等待过程不能像alert一样阻塞程序运行的时候需要异步</p>
<pre><code>定时任务:setTimeout,setInterval
网络请求:ajax请求,动态<img>加载
事件绑定
</code></pre><h1 id="JS-Web-API"><a href="#JS-Web-API" class="headerlink" title="JS-Web-API"></a>JS-Web-API</h1></li>
<li><strong>JS基础</strong><br> ECMA262标准<pre><code>类型,原型,作用域,异步
</code></pre> 特点:表面看并不能用于工作中开发代码</li>
<li><strong>JS-web-api</strong><br> W3C标准中关于JS的规定有:<pre><code>DOM操作
BOM操作
事件绑定
ajax请求(包括http协议)
存储
</code></pre> JS内置全局函数和对象<pre><code>JS变量中提到的和window,document,navigator等
</code></pre></li>
<li><strong>JS(浏览器执行的JS)构成</strong><br> JS基础(ECMA262标准)<br> JS-web-api(W3C标准)<br> (服务器执行的js,如nodejs包含”ECMA262标准”,但不包含”W3C标准”)</li>
<li><p><strong>DOM</strong><br> 本质:浏览器把拿到的html文件结构化成浏览器和JS都可识别的模型,即为DOM<br> 数据结构:树结构<br> 节点操作:</p>
<pre><code>获取DOM节点
document.getElementById('id') //元素
document.getElementsByTagName('body')[0]; //集合
document.getElementsByClassName('.con'); //集合
document.querySelectorAll('p'); //集合
prototype(JS对象属性)
var pList = document.querySelectorAll('p');
var p = pList[0]; //p为js对象
console.log(p.style.width); //获取样式
p.style.width = '100px'; //修改样式
console.log(p.className); //获取class
p.className = 'p1'; //修改class
//获取nodeName和nodeType
console.log(p.nodeName); //P
console.log(p.nodeType);
Attribute(改html文档标签属性)
var pList = document.querySelectorAll('p');
var p = pList[0]; //p为js对象
p.getAttribute('data-name');
p.setAttribute('data-name','imooc');
p.getAttribute('style');
p.setAttribute('style','font-size:30px;');
</code></pre><p> 结构操作:</p>
<pre><code><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line">//新增节点</span><br><span class="line">var div1 = document.getElementById('div1');</span><br><span class="line">var p1 = document.createElement('p'); //创建新节点</span><br><span class="line">p1.innerHTML = 'this is p1';</span><br><span class="line">div1.appendChild(p1); //添加新节点到div1</span><br><span class="line">var p2 = document.getElementById('p2');</span><br><span class="line">div1.appendChild(p2); //移动已存在的节点p2到div1</span><br><span class="line">//获取父元素</span><br><span class="line">var parent = div1.parentElement;</span><br><span class="line">//获取子元素</span><br><span class="line">var child = div1.childNodes; //注意text节点</span><br><span class="line">var child = div1.childNodes[0].nodeType; // 3 (通用)</span><br><span class="line">var child = div1.childNodes[1].nodeType; // 1</span><br><span class="line">var child = div1.childNodes[0].nodeName; // #text (浏览器差异)</span><br><span class="line">var child = div1.childNodes[1].nodeName; // P</span><br><span class="line">//删除节点</span><br><span class="line">div1.removeChild(child[1]); //注意空text节点</span><br></pre></td></tr></table></figure>
</code></pre></li>
<li><p><strong>BOM</strong><br> 浏览器类型<br> 解析url<br> 内置对象</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line">//navigator</span><br><span class="line">var ua = navigator.userAgent; //此信息可被浏览器公司修改,不能保证真实性</span><br><span class="line">console.log(ua); //"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.162 Safari/537.36"</span><br><span class="line">var isChrome = ua.indexOf('Chrome'); //简单判断浏览器</span><br><span class="line">//screen(获取屏幕像素,与浏览器缩放比有关,不同浏览器又有差异)</span><br><span class="line">console.log(screen.width); //1920(Edge,100%), 1536(Edge,125%), 1536(Chrome,控制台下调整缩放比无效)</span><br><span class="line">console.log(screen.height); //1080(Edge,100%), 864(Edge,125%), 864(Chrome)</span><br><span class="line">//location(浏览器会将url中的中文编码,以谷歌搜索vuejs为例,自定义hash:#123)</span><br><span class="line">console.log(location.href); // https://www.google.com/search?q=vuejs&oq=vuejs&aqs=chrome..69i57j0j35i39j0l2j69i65.1977j0j8&sourceid=chrome&ie=UTF-8#123</span><br><span class="line">console.log(location.protocol); // https:</span><br><span class="line">console.log(location.host); // www.google.com</span><br><span class="line">console.log(location.pathname); // /search</span><br><span class="line">console.log(location.search); // ?q=vuejs&oq=vuejs&aqs=chrome..69i57j0j35i39j0l2j69i65.1977j0j8&sourceid=chrome&ie=UTF-8</span><br><span class="line">console.log(location.hash); // #123</span><br><span class="line">//history</span><br><span class="line">history.back(); //前进</span><br><span class="line">history.forward(); //后退</span><br></pre></td></tr></table></figure>
</li>
<li><p><strong>事件</strong><br> 通用事件绑定:</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">var btn = document.getElementById('btn1');</span><br><span class="line">//IE低版本使用attachEvent绑定事件</span><br><span class="line">btn.addEventListener('click',function(event){</span><br><span class="line"> console.log('clicked');</span><br><span class="line">})</span><br><span class="line">function bindEvent(ele,type,fn){</span><br><span class="line"> ele.addEventListener(type,fn);</span><br><span class="line">}</span><br><span class="line">var a = docunment.getElementById('link1');</span><br><span class="line">bindEvent(a,'click',function(e){</span><br><span class="line"> e.preventDefault(); //阻止默认事件</span><br><span class="line"> e.stopPropatation(); //阻止事件冒泡</span><br><span class="line"> alert('clicked');</span><br><span class="line">})</span><br></pre></td></tr></table></figure>
<p> 事件冒泡(默认)</p>
<pre><code>Element.addEventListener('click',fn,false); //第三个参数不写默认为false,即默认冒泡
点击子元素,会依次触发自身和父级元素的对应事件
e.stopPropatation(); //阻止事件冒泡
</code></pre><p> 事件捕获</p>
<pre><code>Element.addEventListener('click',fn,true);
点击子元素,如果父元素注册了事件捕获,则会先触发父元素事件
</code></pre><p> 代理(点击div1里面的多个a元素):代码简洁、减少浏览器内存占用</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">var div1 = document.getElementById('div1');</span><br><span class="line">div1.addEventListener('click',function(e){</span><br><span class="line"> var target = e.target; //获取点击的html元素</span><br><span class="line"> if(target.nodeName === 'A'){</span><br><span class="line"> alert(target.innerHTML)</span><br><span class="line"> }</span><br><span class="line">})</span><br></pre></td></tr></table></figure>
</li>
<li><p><strong>ajax</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br></pre></td><td class="code"><pre><span class="line">var xhr = new XMLHttpRequest;</span><br><span class="line">//open方法</span><br><span class="line">xhr.open('get,'/api',true); //默认异步true</span><br><span class="line">xhr.send(null);</span><br><span class="line">//post方法</span><br><span class="line">xhr.open('post','/api');</span><br><span class="line">xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");</span><br><span class="line">xhr.send('username=name&&pwd=123');</span><br><span class="line"></span><br><span class="line">xhr.onreadystatechange = function(){</span><br><span class="line"> if(xhr.readyState == 4 && xhr.status == 200){</span><br><span class="line"> alert(xhr.responseText);</span><br><span class="line"> }</span><br><span class="line">}</span><br><span class="line">//readyState=0,(未初始化)还未调用send()方法</span><br><span class="line">//readyState=1,已调用send()方法,正在发送请求</span><br><span class="line">//readyState=2,send()执行完成,已收到全部响应内容</span><br><span class="line">//readyState=3,解析相应内容</span><br><span class="line">//readyState=4,完成解析,可调用</span><br><span class="line">//status=2XX,成功处理请求,(200)</span><br><span class="line">//status=3XX,需要重定向,浏览器直接跳转</span><br><span class="line">//status=4XX,客户端请求错位,(404)</span><br><span class="line">//status=5XX,服务器端错误</span><br></pre></td></tr></table></figure>
</li>
</ul>
<blockquote>
<p>持续更新</p>
</blockquote>
</div>
<footer class="post-footer">
<div class="post-nav">
<div class="post-nav-next post-nav-item">
<a href="/third-article.html" rel="next" title="前端笔记">
<i class="fa fa-chevron-left"></i> 前端笔记
</a>
</div>
<span class="post-nav-divider"></span>
<div class="post-nav-prev post-nav-item">
<a href="/hello-world.html" rel="prev" title="Hello World">
Hello World <i class="fa fa-chevron-right"></i>
</a>
</div>
</div>
</footer>
</div>
</article>
<div class="post-spread">
</div>
</div>
</div>
</div>
<div class="sidebar-toggle">
<div class="sidebar-toggle-line-wrap">
<span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
<span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
<span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
</div>
</div>
<aside id="sidebar" class="sidebar">
<div class="sidebar-inner">
<ul class="sidebar-nav motion-element">
<li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
文章目录
</li>
<li class="sidebar-nav-overview" data-target="site-overview-wrap">
站点概览
</li>
</ul>
<section class="site-overview-wrap sidebar-panel">
<div class="site-overview">
<div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
<img class="site-author-image" itemprop="image"
src="/images/1.jpg"
alt="Leo" />
<p class="site-author-name" itemprop="name">Leo</p>
<p class="site-description motion-element" itemprop="description">SEO</p>
</div>
<nav class="site-state motion-element">
<div class="site-state-item site-state-posts">
<a href="/archives/">
<span class="site-state-item-count">5</span>
<span class="site-state-item-name">日志</span>
</a>
</div>
<div class="site-state-item site-state-categories">
<a href="/categories/index.html">
<span class="site-state-item-count">2</span>
<span class="site-state-item-name">分类</span>
</a>
</div>
<div class="site-state-item site-state-tags">
<a href="/tags/index.html">
<span class="site-state-item-count">2</span>
<span class="site-state-item-name">标签</span>
</a>
</div>
</nav>
<div class="links-of-author motion-element">
<span class="links-of-author-item">
<a href="https://github.com/wwilll" target="_blank" title="GitHub">
<i class="fa fa-fw fa-github"></i>GitHub</a>
</span>
<span class="links-of-author-item">
<a href="mailto:[email protected]" target="_blank" title="E-Mail">
<i class="fa fa-fw fa-envelope"></i>E-Mail</a>
</span>
</div>
<div class="links-of-blogroll motion-element links-of-blogroll-block">
<div class="links-of-blogroll-title">
<i class="fa fa-fw fa-link"></i>
Links
</div>
<ul class="links-of-blogroll-list">
<li class="links-of-blogroll-item">
<a href="http://mackxin.com/" title="馨客栈" target="_blank">馨客栈</a>
</li>
</ul>
</div>
</div>
</section>
<!--noindex-->
<section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
<div class="post-toc">
<div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#JS变量"><span class="nav-number">1.</span> <span class="nav-text">JS变量</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#原型"><span class="nav-number">2.</span> <span class="nav-text">原型</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#作用域和闭包"><span class="nav-number">3.</span> <span class="nav-text">作用域和闭包</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#JS-Web-API"><span class="nav-number">4.</span> <span class="nav-text">JS-Web-API</span></a></li></ol></div>
</div>
</section>
<!--/noindex-->
</div>
</aside>
</div>
</main>
<footer id="footer" class="footer">
<div class="footer-inner">
<div class="copyright">© <span itemprop="copyrightYear">2018</span>
<span class="with-love">
<i class="fa fa-user"></i>
</span>
<span class="author" itemprop="copyrightHolder">Leo</span>
</div>
<div class="powered-by">由 <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a> 强力驱动</div>
<span class="post-meta-divider">|</span>
<div class="theme-info">主题 — <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Gemini</a> v5.1.4</div>
</div>
</footer>
<div class="back-to-top">
<i class="fa fa-arrow-up"></i>
</div>
</div>
<script type="text/javascript">
if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
window.Promise = null;
}
</script>
<script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
<script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
<script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
<script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
<script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
<script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
<script type="text/javascript" src="/lib/three/three.min.js"></script>
<script type="text/javascript" src="/lib/three/canvas_lines.min.js"></script>
<script type="text/javascript" src="/js/src/utils.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/motion.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/affix.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.4"></script>
</body>
</html>