Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ca8cb5b

Browse filesBrowse files
ES6-10
1 parent 15fe924 commit ca8cb5b
Copy full SHA for ca8cb5b

File tree

Expand file treeCollapse file tree

7 files changed

+74
-22
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

7 files changed

+74
-22
lines changed
Open diff view settings
Collapse file

‎01-JS语言基础/数据类型与转换/06-伪数组.html‎

Copy file name to clipboardExpand all lines: 01-JS语言基础/数据类型与转换/06-伪数组.html
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
<!--
2+
* @Author: victorsun - csxiaoyao
3+
* @Date: 2019-01-12 16:25:43
4+
* @LastEditors: victorsun
5+
* @LastEditTime: 2020-02-02 14:07:22
6+
* @Description: www.csxiaoyao.com
7+
-->
18
<!DOCTYPE html>
29
<html>
310
<head lang="en">
@@ -6,6 +13,9 @@
613
</head>
714
<body>
815
<script>
16+
// 伪数组特征,值按索引存储,包含length属性
17+
// 常见伪数组:arguments / nodeList(js原生获取dom)
18+
919
// arguments
1020
fn(1,2);
1121
fn(1,2,3,4,5);
Collapse file

‎01-JS语言基础/数据类型与转换/Array.html‎

Copy file name to clipboardExpand all lines: 01-JS语言基础/数据类型与转换/Array.html
+7-1Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,26 @@
2020
var array1 = [1,2,3];
2121
var array2 = [];
2222
// 对象创建
23+
let arr0 = Array(5)
2324
var arr1 = new Array(); //空数组
2425
var arr2 = new Array("关羽","张飞","刘备");
2526
var arr3 = new Array(1,2,3);
2627

2728
// 【概念】:浅拷贝、深拷贝
2829
// 浅拷贝,复制的是引用
2930
// 深拷贝,遍历数组赋值,复制的是值
31+
// TODO
3032

3133
// 在javascript中数组长度可变
32-
var arr = new Array(3); //创建了一个长度为【0】的数组对象
34+
var arr = new Array(3); // 创建了一个长度为3的数组对象
3335
arr[100] = 10;
3436
document.write("arr长度:"+arr.length+"<br/>");//101
3537
var arr = new Array("sun1","sun2","sun3");
3638
arr = ["sun4","sun5","sun6","sun7"];
3739
document.write("arr长度:"+arr.length+"<br/>");//4
3840

41+
// 【 ES6 方式 】见es6总结
42+
3943
/**
4044
* 常用方法
4145
*/
@@ -55,6 +59,8 @@
5559
// filter(), concat(), slice()
5660

5761
// (五) 迭代器方法
62+
// for循环,支持 break/continue,其他非for/for...of/for...in迭代器不支持
63+
// for...of (尽量不用for...in遍历数组,因为for...in是用来遍历对象的,可能有问题)
5864
// 不生成新数组:forEach()、every()、some()、reduce()、reduceRight()
5965
// 生成新数组:map()、filter()
6066

Collapse file

‎01-JS语言基础/语言特性/07-作用域.html‎

Copy file name to clipboardExpand all lines: 01-JS语言基础/语言特性/07-作用域.html
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44
<meta charset="UTF-8">
55
<title>Title</title>
66
<script>
7+
/*
8+
global/window 全局作用域 es5
9+
function 函数作用域(局部作用域) es5
10+
{} 块状作用域 es6
11+
this 动态作用域, 何处调用决定, es5
12+
*/
13+
714
//作用域
815
//变量起作用的范围就是变量的作用域
916
//并不是在函数内部写了变量,这个变量就属于这个函数的作用域,
Collapse file

‎02-ES新特性/ES6/01-let&const.html‎

Copy file name to clipboardExpand all lines: 02-ES新特性/ES6/01-let&const.html
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
<!--
2+
* @Author: victorsun - csxiaoyao
3+
* @Date: 2019-03-23 00:20:31
4+
* @LastEditors: victorsun
5+
* @LastEditTime: 2020-02-02 13:31:20
6+
* @Description: www.csxiaoyao.com
7+
-->
18
<!DOCTYPE html>
29
<html lang="en">
310
<head>
@@ -31,6 +38,13 @@
3138
console.log(PI); // ReferenceError: PI is not defined
3239
const PI = "3.1415926";
3340
}
41+
42+
// 块状作用域
43+
{
44+
let a = 1
45+
console.log(a)
46+
}
47+
// console.log(a) // 报错
3448
</script>
3549
</body>
3650
</html>
Collapse file
+8-1Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
见基础总结总结
1+
<!--
2+
* @Author: victorsun - csxiaoyao
3+
* @Date: 2019-03-31 15:02:45
4+
* @LastEditors: victorsun
5+
* @LastEditTime: 2020-02-02 13:37:49
6+
* @Description: www.csxiaoyao.com
7+
-->
8+
见基础总结
Collapse file

‎02-ES新特性/ES6/09-ES6数组.html‎

Copy file name to clipboardExpand all lines: 02-ES新特性/ES6/09-ES6数组.html
+28-20Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@
1111
/**
1212
* 常用方法
1313
*/
14-
// Array.of() 将参数中所有值作为元素形成数组
15-
// Array.from() 将类数组对象或可迭代对象转化为数组
16-
// find() 查找数组中第一个符合条件的元素
17-
// findIndex() 查找数组中第一个符合条件的元素索引
18-
// fill() 将一定范围索引的数组元素内容填充为单个指定的值
14+
// * Array.of() 【创建】将参数中所有值作为元素形成数组
15+
// * Array.from() 【创建】将类数组对象或可迭代对象转化为数组
16+
// * fill() 【填充】将一定范围索引的数组元素内容填充为单个指定的值
1917
// copyWithin() 将一定范围索引的数组元素修改为此数组另一指定范围索引的元素
18+
19+
// * find() 【查找】数组中(第一个)符合条件的元素
20+
// * findIndex() 【查找】数组中(第一个)符合条件的元素索引
2021
// entries() / next 遍历键值对
2122
// keys() 遍历键名
2223
// values() 遍历键值
@@ -35,10 +36,16 @@
3536
console.log(Array.of()); // []
3637

3738
// 【 Array.from() 】 将类数组对象或可迭代对象转化为数组
38-
// Array.from(arrayLike[, mapFn[, thisArg]])
39+
// Array.prototype.from(arrayLike[, mapFn[, thisArg]])
3940
// arrayLike 必选,类数组对象,即一个对象必须含有length属性,且元素属性名必须是数值或者可转换为数值的字符
4041
// mapFn 可选,map 函数,用于对每个元素进行处理,放入数组的是处理后的元素
4142
// thisArg 可选,用于指定 map 函数执行时的 this 对象
43+
// 伪数组特征,值按索引存储,包含length属性
44+
function test () {
45+
let args = Array.from(arguments)
46+
let imgs = Array.from(document.querySelectorAll('img'))
47+
let array1 = Array.from({ length: 5 })
48+
}
4249
console.log(Array.from([1, , 3])); // [1, undefined, 3]
4350
console.log(Array.from([1, 2, 3], (n) => n * 2)); // [2, 4, 6]
4451
let arrayLike = {
@@ -83,26 +90,14 @@
8390
let str = 'abc';
8491
console.log(Array.from(str)); // ["a", "b", "c"]
8592

86-
/**
87-
* es6 数组查找
88-
*/
89-
// 【 find() 】 查找数组中符合条件的元素,若有多个则返回第一个元素
90-
let arr = Array.of(1, 2, 3, 4);
91-
console.log(arr.find(item => item > 2)); // 3
92-
console.log([, 1].find(n => true)); // undefined 数组空位处理为 undefined
93-
// 【 findIndex() 】 查找数组中符合条件的元素索引,若有多个则返回第一个元素索引
94-
// 参数2(可选):指定回调函数中的 this 值
95-
let arr = Array.of(1, 2, 1, 3);
96-
console.log(arr.findIndex(item => item = 1)); // 0
97-
console.log([, 1].findIndex(n => true)); // 0 数组空位处理为 undefined
98-
9993
/**
10094
* es6 数组填充
10195
*/
10296
// 【 fill() 】 将一定范围索引的数组元素内容填充为单个指定的值
10397
// 参数1:用来填充的值
104-
// 参数2:被填充的起始索引
98+
// 参数2(可选):被填充的起始索引,默认0
10599
// 参数3(可选):被填充的结束索引,默认为数组末尾
100+
Array(5).fill(1) // [1,1,1,1,1]
106101
let arr = Array.of(1, 2, 3, 4);
107102
console.log(arr.fill(0,1,2)); // [1, 0, 3, 4]
108103
// 【 copyWithin() 】 将一定范围索引的数组元素修改为此数组另一指定范围索引的元素
@@ -113,6 +108,19 @@
113108
console.log([1, 2, 3, 4].copyWithin(-2, 0)); // [1, 2, 1, 2]
114109
console.log([1, 2, ,4].copyWithin(0, 2, 4)); // [, 4, , 4]
115110

111+
/**
112+
* es6 数组查找
113+
*/
114+
// 【 find() 】 查找数组中符合条件的元素,若有多个则返回第一个元素
115+
let arr = Array.of(1, 2, 3, 4);
116+
console.log(arr.find(item => item > 2)); // 3
117+
console.log([, 1].find(n => true)); // undefined 数组空位处理为 undefined
118+
// 【 findIndex() 】 查找数组中符合条件的元素索引,若有多个则返回第一个元素索引
119+
// 参数2(可选):指定回调函数中的 this 值
120+
let arr = Array.of(1, 2, 1, 3);
121+
console.log(arr.findIndex(item => item = 1)); // 0
122+
console.log([, 1].findIndex(n => true)); // 0 数组空位处理为 undefined
123+
116124
/**
117125
* es6 数组遍历
118126
*/
Collapse file

‎02-ES新特性/ES7/README.md‎

Copy file name to clipboardExpand all lines: 02-ES新特性/ES7/README.md
Whitespace-only changes.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.