diff --git "a/38\345\274\240\345\205\210\346\235\260/.keep" "b/38\345\274\240\345\205\210\346\235\260/.keep" new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git "a/38\345\274\240\345\205\210\346\235\260/\344\275\234\344\270\232/2022-10-27\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232.html" "b/38\345\274\240\345\205\210\346\235\260/\344\275\234\344\270\232/2022-10-27\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232.html" new file mode 100644 index 0000000000000000000000000000000000000000..b9f88ce51541f3d1d38ed30b8d095114aeea089a --- /dev/null +++ "b/38\345\274\240\345\205\210\346\235\260/\344\275\234\344\270\232/2022-10-27\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232.html" @@ -0,0 +1,23 @@ + + + + + + + Document + + + + + + \ No newline at end of file diff --git "a/38\345\274\240\345\205\210\346\235\260/\347\254\224\350\256\260/2022-10-14-js\347\254\254\344\272\214\346\254\241\344\275\234\344\270\232.md" "b/38\345\274\240\345\205\210\346\235\260/\347\254\224\350\256\260/2022-10-14-js\347\254\254\344\272\214\346\254\241\344\275\234\344\270\232.md" index 21c869b3327ef57c04d18175eaba79c0eb1525d9..a185625de8da6145f4a96545d238fc7de835de96 100644 --- "a/38\345\274\240\345\205\210\346\235\260/\347\254\224\350\256\260/2022-10-14-js\347\254\254\344\272\214\346\254\241\344\275\234\344\270\232.md" +++ "b/38\345\274\240\345\205\210\346\235\260/\347\254\224\350\256\260/2022-10-14-js\347\254\254\344\272\214\346\254\241\344\275\234\344\270\232.md" @@ -1,22 +1,22 @@ -| 1.Switch | | | -| -------- | ------------------------------------------------------------ | ------------------------------------------------------------ | -| | [2](https://gitee.com/level-21-software-class-4/java-script/pulls/13/files#92235d944c8d200216d53b115a72c0ed911dfc34_0_2) | 2.基本数据类型: number , boolean, string, null , undefined | -| | [3](https://gitee.com/level-21-software-class-4/java-script/pulls/13/files#92235d944c8d200216d53b115a72c0ed911dfc34_0_3) | var a = '5'+1 // + 其中有一个是字符串, 默认是字符串的连接 | -| | [4](https://gitee.com/level-21-software-class-4/java-script/pulls/13/files#92235d944c8d200216d53b115a72c0ed911dfc34_0_4) | var a = '5' // | -| | [5](https://gitee.com/level-21-software-class-4/java-script/pulls/13/files#92235d944c8d200216d53b115a72c0ed911dfc34_0_5) | var b = a**2 // + - ** 、 %隐式类型转化 | -| | [6](https://gitee.com/level-21-software-class-4/java-script/pulls/13/files#92235d944c8d200216d53b115a72c0ed911dfc34_0_6) | var b = -a | -| | [7](https://gitee.com/level-21-software-class-4/java-script/pulls/13/files#92235d944c8d200216d53b115a72c0ed911dfc34_0_7) | console.log('类型:' + typeof b + '值:' + b);//查看数据是什么类型 | -| | [8](https://gitee.com/level-21-software-class-4/java-script/pulls/13/files#92235d944c8d200216d53b115a72c0ed911dfc34_0_8) | 3.显示数据类型 | -| | [9](https://gitee.com/level-21-software-class-4/java-script/pulls/13/files#92235d944c8d200216d53b115a72c0ed911dfc34_0_9) | NaN : 非数 number | -| | [10](https://gitee.com/level-21-software-class-4/java-script/pulls/13/files#92235d944c8d200216d53b115a72c0ed911dfc34_0_10) | Number():转换成数字,失败会变成 NaN | -| | [11](https://gitee.com/level-21-software-class-4/java-script/pulls/13/files#92235d944c8d200216d53b115a72c0ed911dfc34_0_11) | false:0 true:1 null:0 undefined:NaN | -| | [12](https://gitee.com/level-21-software-class-4/java-script/pulls/13/files#92235d944c8d200216d53b115a72c0ed911dfc34_0_12) | | -| | [13](https://gitee.com/level-21-software-class-4/java-script/pulls/13/files#92235d944c8d200216d53b115a72c0ed911dfc34_0_13) | parseInt(a,radix): 将(radix)进制 转成 10进制 | -| | [14](https://gitee.com/level-21-software-class-4/java-script/pulls/13/files#92235d944c8d200216d53b115a72c0ed911dfc34_0_14) | //var a = 'F' //-->0 1 2 3 4 5 6 7 8 9 A B C D E F | -| | [15](https://gitee.com/level-21-software-class-4/java-script/pulls/13/files#92235d944c8d200216d53b115a72c0ed911dfc34_0_15) | //var b = parseInt(a,16) | -| | [16](https://gitee.com/level-21-software-class-4/java-script/pulls/13/files#92235d944c8d200216d53b115a72c0ed911dfc34_0_16) | | -| | [17](https://gitee.com/level-21-software-class-4/java-script/pulls/13/files#92235d944c8d200216d53b115a72c0ed911dfc34_0_17) | String():转成字符串 | -| | [18](https://gitee.com/level-21-software-class-4/java-script/pulls/13/files#92235d944c8d200216d53b115a72c0ed911dfc34_0_18) | toFixed(n):保留小数点后n位 | -| | [19](https://gitee.com/level-21-software-class-4/java-script/pulls/13/files#92235d944c8d200216d53b115a72c0ed911dfc34_0_19) | a.toString(radix):将十进制数的a转换成radix进制的数 | -| | [20](https://gitee.com/level-21-software-class-4/java-script/pulls/13/files#92235d944c8d200216d53b115a72c0ed911dfc34_0_20) | isNaN(): 是不是非数,是数字的话--》false 不是数字--》true | -| | [21](https://gitee.com/level-21-software-class-4/java-script/pulls/13/files#92235d944c8d200216d53b115a72c0ed911dfc34_0_21) | Math: 舍入 ceil(向上取整) floor(向下取整) round(四舍五入) | \ No newline at end of file +| 1.Switch | | +| -------- | ------------------------------------------------------------ | +| | 2.基本数据类型: number , boolean, string, null , undefined | +| | var a = '5'+1 // + 其中有一个是字符串, 默认是字符串的连接 | +| | var a = '5' // | +| | var b = a**2 // + - ** 、 %隐式类型转化 | +| | var b = -a | +| | console.log('类型:' + typeof b + '值:' + b);//查看数据是什么类型 | +| | 3.显示数据类型 | +| | NaN : 非数 number | +| | Number():转换成数字,失败会变成 NaN | +| | false:0 true:1 null:0 undefined:NaN | +| | | +| | parseInt(a,radix): 将(radix)进制 转成 10进制 | +| | //var a = 'F' //-->0 1 2 3 4 5 6 7 8 9 A B C D E F | +| | //var b = parseInt(a,16) | +| | | +| | String():转成字符串 | +| | toFixed(n):保留小数点后n位 | +| | a.toString(radix):将十进制数的a转换成radix进制的数 | +| | isNaN(): 是不是非数,是数字的话--》false 不是数字--》true | +| | Math: 舍入 ceil(向上取整) floor(向下取整) round(四舍五入) | \ No newline at end of file diff --git "a/38\345\274\240\345\205\210\346\235\260/\347\254\224\350\256\260/2022-10-20\347\254\254\345\233\233\346\254\241\344\275\234\344\270\232.md" "b/38\345\274\240\345\205\210\346\235\260/\347\254\224\350\256\260/2022-10-20\347\254\254\345\233\233\346\254\241\344\275\234\344\270\232.md" index 05d54f59f31e68f4b841895bf90ff4d4e4bdd505..a5a138c2195ea869e9abf6423b39527cca076c56 100644 --- "a/38\345\274\240\345\205\210\346\235\260/\347\254\224\350\256\260/2022-10-20\347\254\254\345\233\233\346\254\241\344\275\234\344\270\232.md" +++ "b/38\345\274\240\345\205\210\346\235\260/\347\254\224\350\256\260/2022-10-20\347\254\254\345\233\233\346\254\241\344\275\234\344\270\232.md" @@ -1,83 +1,83 @@ -| 数组: | | | -| ----- | ------------------------------------------------------------ | ------------------------------------------------------------ | -| | [2](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_2) | concat:连接,数组合并 | -| | [3](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_3) | 例子: | -| | [4](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_4) | const arr = [1,2,3] | -| | [5](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_5) | const arr1 = [4,5,6] | -| | [6](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_6) | console.log(arr1); | -| | [7](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_7) | join:将数组转成字符串] | -| | [8](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_8) | forEach(遍历数组) | -| | [9](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_9) | 例子: | -| | [10](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_10) | arr.forEach( | -| | [11](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_11) | | -| | [12](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_12) | function (element){ | -| | [13](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_13) | console.log(element); | -| | [14](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_14) | } | -| | [15](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_15) | ) | -| | [16](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_16) | 映射方法map() | -| | [17](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_17) | 例: | -| | [18](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_18) | const arr=[1, 2, 3, 4, 5, 6] | -| | [19](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_19) | const arr1 = arr.map( | -| | [20](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_20) | function (element) { | -| | [21](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_21) | return element + 1 | -| | [22](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_22) | } | -| | [23](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_23) | ) | -| | [24](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_24) | | -| | [25](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_25) | 将数组的单词全转为大写 | -| | [26](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_26) | 例: | -| | [27](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_27) | const countries = ['Finland', 'Sweden', 'Norway', 'Denmark', 'Iceland'] | -| | [28](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_28) | const new_countries = countries.map( | -| | [29](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_29) | function (e){ | -| | [30](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_30) | return e.toUpperCase() | -| | [31](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_31) | } | -| | [32](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_32) | ) | -| | [33](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_33) | filter过滤:返回数组中符合条件的数据 | -| | [34](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_34) | 例: | -| | [35](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_35) | const new_arr = arr.filter( | -| | [36](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_36) | function (e){ | -| | [37](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_37) | return e%2==0 //true:返回 false:不符合条件=>过滤 | -| | [38](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_38) | } | -| | [39](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_39) | ) | -| | [40](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_40) | | -| | [41](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_41) | reduce(),reduceRight():归纳汇总: 返回一个总数据 | -| | [42](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_42) | 例: | -| | [43](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_43) | const arr = [1, 2, 3, 4, 5, 6] | -| | [44](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_44) | var sum = arr.reduceRight( | -| | [45](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_45) | function (v1,v2){ | -| | [46](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_46) | return v1*v2 | -| | [47](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_47) | } | -| | [48](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_48) | ) | -| | [49](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_49) | | -| | [50](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_50) | every():只要有一个false,返回 | -| | [51](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_51) | 例: | -| | [52](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_52) | some() | -| | [53](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_53) | var isMatch = arr.every( | -| | [54](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_54) | function (e){ | -| | [55](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_55) | return e>1 | -| | [56](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_56) | } | -| | [57](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_57) | ) | -| | [58](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_58) | | -| | [59](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_59) | var isMatch = arr.some( | -| | [60](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_60) | function (e){ | -| | [61](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_61) | return e==6 | -| | [62](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_62) | } | -| | [63](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_63) | ) | -| | [64](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_64) | | -| | [65](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_65) | 二维数组 | -| | [66](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_66) | const arrayOfArray = [[1, 2, 3], [4, 5, 6]] | -| | [67](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_67) | 增删改查 | -| | [68](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_68) | console.log(arrayOfArray[1][1]); | -| | [69](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_69) | | -| | [70](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_70) | 删 | -| | [71](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_71) | arrayOfArray[1].splice(1,1) | -| | [72](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_72) | console.log(arrayOfArray); | -| | [73](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_73) | 函数 | -| | [74](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_74) | 带参(形参) | -| | [75](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_75) | undefined:变量声明了但没有赋值 | -| | [76](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_76) | null:变量声明,并且有个空引用 | -| | [77](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_77) | ...args:剩余运算符,将剩下的参数都放进args数组中 | -| | [78](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_78) | function fn(A,B,...args){ | -| | [79](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_79) | rguments:伪数组 | -| | [80](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_80) | for (let index = 0; index < arguments.length; index++) { | -| | [81](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_81) | console.log(arguments[index]); | -| | [82](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#7dfbb5f92d49bd56a2732ccddaa804aca324b6f7_0_82) | } | \ No newline at end of file +| 数组: | | +| ----- | ------------------------------------------------------------ | +| | concat:连接,数组合并 | +| | 例子: | +| | const arr = [1,2,3] | +| | const arr1 = [4,5,6] | +| | console.log(arr1); | +| | join:将数组转成字符串] | +| | forEach(遍历数组) | +| | 例子: | +| | arr.forEach( | +| | | +| | function (element){ | +| | console.log(element); | +| | } | +| | ) | +| | 映射方法map() | +| | 例: | +| | const arr=[1, 2, 3, 4, 5, 6] | +| | const arr1 = arr.map( | +| | function (element) { | +| | return element + 1 | +| | } | +| | ) | +| | | +| | 将数组的单词全转为大写 | +| | 例: | +| | const countries = ['Finland', 'Sweden', 'Norway', 'Denmark', 'Iceland'] | +| | const new_countries = countries.map( | +| | function (e){ | +| | return e.toUpperCase() | +| | } | +| | ) | +| | filter过滤:返回数组中符合条件的数据 | +| | 例: | +| | const new_arr = arr.filter( | +| | function (e){ | +| | return e%2==0 //true:返回 false:不符合条件=>过滤 | +| | } | +| | ) | +| | | +| | reduce(),reduceRight():归纳汇总: 返回一个总数据 | +| | 例: | +| | const arr = [1, 2, 3, 4, 5, 6] | +| | var sum = arr.reduceRight( | +| | function (v1,v2){ | +| | return v1*v2 | +| | } | +| | ) | +| | | +| | every():只要有一个false,返回 | +| | 例: | +| | some() | +| | var isMatch = arr.every( | +| | function (e){ | +| | return e>1 | +| | } | +| | ) | +| | | +| | var isMatch = arr.some( | +| | function (e){ | +| | return e==6 | +| | } | +| | ) | +| | | +| | 二维数组 | +| | const arrayOfArray = [[1, 2, 3], [4, 5, 6]] | +| | 增删改查 | +| | console.log(arrayOfArray[1][1]); | +| | | +| | 删 | +| | arrayOfArray[1].splice(1,1) | +| | console.log(arrayOfArray); | +| | 函数 | +| | 带参(形参) | +| | undefined:变量声明了但没有赋值 | +| | null:变量声明,并且有个空引用 | +| | ...args:剩余运算符,将剩下的参数都放进args数组中 | +| | function fn(A,B,...args){ | +| | rguments:伪数组 | +| | for (let index = 0; index < arguments.length; index++) { | +| | console.log(arguments[index]); | +| | } | \ No newline at end of file diff --git "a/38\345\274\240\345\205\210\346\235\260/\347\254\224\350\256\260/2022-10-24js\347\254\254\345\205\255\346\254\241\344\275\234\344\270\232.md" "b/38\345\274\240\345\205\210\346\235\260/\347\254\224\350\256\260/2022-10-24js\347\254\254\345\205\255\346\254\241\344\275\234\344\270\232.md" index 3b6b9dcd2bec0e096f2a67486b330c98d0be5425..7848fcbb129eda1c81fcac3f288a33d843bf4238 100644 --- "a/38\345\274\240\345\205\210\346\235\260/\347\254\224\350\256\260/2022-10-24js\347\254\254\345\205\255\346\254\241\344\275\234\344\270\232.md" +++ "b/38\345\274\240\345\205\210\346\235\260/\347\254\224\350\256\260/2022-10-24js\347\254\254\345\205\255\346\254\241\344\275\234\344\270\232.md" @@ -1,43 +1,43 @@ -| 6、对象 | | | -| ------- | ------------------------------------------------------------ | ---------------------------------------------------------- | -| | [2](https://gitee.com/level-21-software-class-4/java-script/pulls/124/files#e7b817a3809f75036f44b7bee8d0e90848b09a21_0_2) | | -| | [3](https://gitee.com/level-21-software-class-4/java-script/pulls/124/files#e7b817a3809f75036f44b7bee8d0e90848b09a21_0_3) | ## 6.1 定义对象 | -| | [4](https://gitee.com/level-21-software-class-4/java-script/pulls/124/files#e7b817a3809f75036f44b7bee8d0e90848b09a21_0_4) | | -| | [5](https://gitee.com/level-21-software-class-4/java-script/pulls/124/files#e7b817a3809f75036f44b7bee8d0e90848b09a21_0_5) | 字面量 | -| | [6](https://gitee.com/level-21-software-class-4/java-script/pulls/124/files#e7b817a3809f75036f44b7bee8d0e90848b09a21_0_6) | | -| | [7](https://gitee.com/level-21-software-class-4/java-script/pulls/124/files#e7b817a3809f75036f44b7bee8d0e90848b09a21_0_7) | var obj = { | -| | [8](https://gitee.com/level-21-software-class-4/java-script/pulls/124/files#e7b817a3809f75036f44b7bee8d0e90848b09a21_0_8) | name:value; | -| | [9](https://gitee.com/level-21-software-class-4/java-script/pulls/124/files#e7b817a3809f75036f44b7bee8d0e90848b09a21_0_9) | 'String':value; | -| | [10](https://gitee.com/level-21-software-class-4/java-script/pulls/124/files#e7b817a3809f75036f44b7bee8d0e90848b09a21_0_10) | } | -| | [11](https://gitee.com/level-21-software-class-4/java-script/pulls/124/files#e7b817a3809f75036f44b7bee8d0e90848b09a21_0_11) | | -| | [12](https://gitee.com/level-21-software-class-4/java-script/pulls/124/files#e7b817a3809f75036f44b7bee8d0e90848b09a21_0_12) | 构造函数 | -| | [13](https://gitee.com/level-21-software-class-4/java-script/pulls/124/files#e7b817a3809f75036f44b7bee8d0e90848b09a21_0_13) | | -| | [14](https://gitee.com/level-21-software-class-4/java-script/pulls/124/files#e7b817a3809f75036f44b7bee8d0e90848b09a21_0_14) | function GetName() { | -| | [15](https://gitee.com/level-21-software-class-4/java-script/pulls/124/files#e7b817a3809f75036f44b7bee8d0e90848b09a21_0_15) | this.name = values; | -| | [16](https://gitee.com/level-21-software-class-4/java-script/pulls/124/files#e7b817a3809f75036f44b7bee8d0e90848b09a21_0_16) | this.age = values; | -| | [17](https://gitee.com/level-21-software-class-4/java-script/pulls/124/files#e7b817a3809f75036f44b7bee8d0e90848b09a21_0_17) | } | -| | [18](https://gitee.com/level-21-software-class-4/java-script/pulls/124/files#e7b817a3809f75036f44b7bee8d0e90848b09a21_0_18) | | -| | [19](https://gitee.com/level-21-software-class-4/java-script/pulls/124/files#e7b817a3809f75036f44b7bee8d0e90848b09a21_0_19) | 工厂模式(设计模式) | -| | [20](https://gitee.com/level-21-software-class-4/java-script/pulls/124/files#e7b817a3809f75036f44b7bee8d0e90848b09a21_0_20) | | -| | [21](https://gitee.com/level-21-software-class-4/java-script/pulls/124/files#e7b817a3809f75036f44b7bee8d0e90848b09a21_0_21) | function GetValues(name,age) { | -| | [22](https://gitee.com/level-21-software-class-4/java-script/pulls/124/files#e7b817a3809f75036f44b7bee8d0e90848b09a21_0_22) | var that = { } | -| | [23](https://gitee.com/level-21-software-class-4/java-script/pulls/124/files#e7b817a3809f75036f44b7bee8d0e90848b09a21_0_23) | that.name = name | -| | [24](https://gitee.com/level-21-software-class-4/java-script/pulls/124/files#e7b817a3809f75036f44b7bee8d0e90848b09a21_0_24) | that.age = age | -| | [25](https://gitee.com/level-21-software-class-4/java-script/pulls/124/files#e7b817a3809f75036f44b7bee8d0e90848b09a21_0_25) | return that | -| | [26](https://gitee.com/level-21-software-class-4/java-script/pulls/124/files#e7b817a3809f75036f44b7bee8d0e90848b09a21_0_26) | } | -| | [27](https://gitee.com/level-21-software-class-4/java-script/pulls/124/files#e7b817a3809f75036f44b7bee8d0e90848b09a21_0_27) | | -| | [28](https://gitee.com/level-21-software-class-4/java-script/pulls/124/files#e7b817a3809f75036f44b7bee8d0e90848b09a21_0_28) | 生成对象 | -| | [29](https://gitee.com/level-21-software-class-4/java-script/pulls/124/files#e7b817a3809f75036f44b7bee8d0e90848b09a21_0_29) | | -| | [30](https://gitee.com/level-21-software-class-4/java-script/pulls/124/files#e7b817a3809f75036f44b7bee8d0e90848b09a21_0_30) | var obj = new obj(); | -| | [31](https://gitee.com/level-21-software-class-4/java-script/pulls/124/files#e7b817a3809f75036f44b7bee8d0e90848b09a21_0_31) | | -| | [32](https://gitee.com/level-21-software-class-4/java-script/pulls/124/files#e7b817a3809f75036f44b7bee8d0e90848b09a21_0_32) | ## 6.2 增删查 | -| | [33](https://gitee.com/level-21-software-class-4/java-script/pulls/124/files#e7b817a3809f75036f44b7bee8d0e90848b09a21_0_33) | | -| | [34](https://gitee.com/level-21-software-class-4/java-script/pulls/124/files#e7b817a3809f75036f44b7bee8d0e90848b09a21_0_34) | 查:obj.name | -| | [35](https://gitee.com/level-21-software-class-4/java-script/pulls/124/files#e7b817a3809f75036f44b7bee8d0e90848b09a21_0_35) | | -| | [36](https://gitee.com/level-21-software-class-4/java-script/pulls/124/files#e7b817a3809f75036f44b7bee8d0e90848b09a21_0_36) | 增:obj.原来obj中没有的属性,相当于将该属性添加到对象obj中 | -| | [37](https://gitee.com/level-21-software-class-4/java-script/pulls/124/files#e7b817a3809f75036f44b7bee8d0e90848b09a21_0_37) | | -| | [38](https://gitee.com/level-21-software-class-4/java-script/pulls/124/files#e7b817a3809f75036f44b7bee8d0e90848b09a21_0_38) | 删:delete 一般删之前要对该属性进行判断 | -| | [39](https://gitee.com/level-21-software-class-4/java-script/pulls/124/files#e7b817a3809f75036f44b7bee8d0e90848b09a21_0_39) | | -| | [40](https://gitee.com/level-21-software-class-4/java-script/pulls/124/files#e7b817a3809f75036f44b7bee8d0e90848b09a21_0_40) | ## 6.3 对象解构 | -| | [41](https://gitee.com/level-21-software-class-4/java-script/pulls/124/files#e7b817a3809f75036f44b7bee8d0e90848b09a21_0_41) | | -| | [42](https://gitee.com/level-21-software-class-4/java-script/pulls/124/files#e7b817a3809f75036f44b7bee8d0e90848b09a21_0_42) | let{name:personName, age:personAge} = obj(取别名) | \ No newline at end of file +| 6、对象 | | +| ------- | ---------------------------------------------------------- | +| | | +| | ## 6.1 定义对象 | +| | | +| | 字面量 | +| | | +| | var obj = { | +| | name:value; | +| | 'String':value; | +| | } | +| | | +| | 构造函数 | +| | | +| | function GetName() { | +| | this.name = values; | +| | this.age = values; | +| | } | +| | | +| | 工厂模式(设计模式) | +| | | +| | function GetValues(name,age) { | +| | var that = { } | +| | that.name = name | +| | that.age = age | +| | return that | +| | } | +| | | +| | 生成对象 | +| | | +| | var obj = new obj(); | +| | | +| | ## 6.2 增删查 | +| | | +| | 查:obj.name | +| | | +| | 增:obj.原来obj中没有的属性,相当于将该属性添加到对象obj中 | +| | | +| | 删:delete 一般删之前要对该属性进行判断 | +| | | +| | ## 6.3 对象解构 | +| | | +| | let{name:personName, age:personAge} = obj(取别名) | \ No newline at end of file diff --git "a/38\345\274\240\345\205\210\346\235\260/\347\254\224\350\256\260/2022-10-26js\347\254\254\344\270\203\350\212\202\344\270\223\344\270\232\350\257\276.md" "b/38\345\274\240\345\205\210\346\235\260/\347\254\224\350\256\260/2022-10-26js\347\254\254\344\270\203\350\212\202\344\270\223\344\270\232\350\257\276.md" index 113e3de436eaf11ecdb120220cac0959bf8b1726..3e509bb6e2b57dbdbcace342f112b0b20c46413b 100644 --- "a/38\345\274\240\345\205\210\346\235\260/\347\254\224\350\256\260/2022-10-26js\347\254\254\344\270\203\350\212\202\344\270\223\344\270\232\350\257\276.md" +++ "b/38\345\274\240\345\205\210\346\235\260/\347\254\224\350\256\260/2022-10-26js\347\254\254\344\270\203\350\212\202\344\270\223\344\270\232\350\257\276.md" @@ -1,31 +1,31 @@ -| 字面量 | | | -| ------ | ------------------------------------------------------------ | ------------------------------ | -| | [6](https://gitee.com/level-21-software-class-4/java-script/pulls/155/files#4c54f97bde7b1ddd7cfb3625805a0ec31119e57b_0_6) | | -| | [7](https://gitee.com/level-21-software-class-4/java-script/pulls/155/files#4c54f97bde7b1ddd7cfb3625805a0ec31119e57b_0_7) | var obj = { | -| | [8](https://gitee.com/level-21-software-class-4/java-script/pulls/155/files#4c54f97bde7b1ddd7cfb3625805a0ec31119e57b_0_8) | name:value; | -| | [9](https://gitee.com/level-21-software-class-4/java-script/pulls/155/files#4c54f97bde7b1ddd7cfb3625805a0ec31119e57b_0_9) | 'String':value; | -| | [10](https://gitee.com/level-21-software-class-4/java-script/pulls/155/files#4c54f97bde7b1ddd7cfb3625805a0ec31119e57b_0_10) | } | -| | [11](https://gitee.com/level-21-software-class-4/java-script/pulls/155/files#4c54f97bde7b1ddd7cfb3625805a0ec31119e57b_0_11) | | -| | [12](https://gitee.com/level-21-software-class-4/java-script/pulls/155/files#4c54f97bde7b1ddd7cfb3625805a0ec31119e57b_0_12) | 构造函数 | -| | [13](https://gitee.com/level-21-software-class-4/java-script/pulls/155/files#4c54f97bde7b1ddd7cfb3625805a0ec31119e57b_0_13) | | -| | [14](https://gitee.com/level-21-software-class-4/java-script/pulls/155/files#4c54f97bde7b1ddd7cfb3625805a0ec31119e57b_0_14) | function GetName() { | -| | [15](https://gitee.com/level-21-software-class-4/java-script/pulls/155/files#4c54f97bde7b1ddd7cfb3625805a0ec31119e57b_0_15) | this.name = values; | -| | [16](https://gitee.com/level-21-software-class-4/java-script/pulls/155/files#4c54f97bde7b1ddd7cfb3625805a0ec31119e57b_0_16) | this.age = values; | -| | [17](https://gitee.com/level-21-software-class-4/java-script/pulls/155/files#4c54f97bde7b1ddd7cfb3625805a0ec31119e57b_0_17) | } | -| | [18](https://gitee.com/level-21-software-class-4/java-script/pulls/155/files#4c54f97bde7b1ddd7cfb3625805a0ec31119e57b_0_18) | | -| | [19](https://gitee.com/level-21-software-class-4/java-script/pulls/155/files#4c54f97bde7b1ddd7cfb3625805a0ec31119e57b_0_19) | 工厂模式(设计模式) | -| | [20](https://gitee.com/level-21-software-class-4/java-script/pulls/155/files#4c54f97bde7b1ddd7cfb3625805a0ec31119e57b_0_20) | | -| | [21](https://gitee.com/level-21-software-class-4/java-script/pulls/155/files#4c54f97bde7b1ddd7cfb3625805a0ec31119e57b_0_21) | function GetValues(name,age) { | -| | [22](https://gitee.com/level-21-software-class-4/java-script/pulls/155/files#4c54f97bde7b1ddd7cfb3625805a0ec31119e57b_0_22) | var that = { } | -| | [23](https://gitee.com/level-21-software-class-4/java-script/pulls/155/files#4c54f97bde7b1ddd7cfb3625805a0ec31119e57b_0_23) | that.name = name | -| | [24](https://gitee.com/level-21-software-class-4/java-script/pulls/155/files#4c54f97bde7b1ddd7cfb3625805a0ec31119e57b_0_24) | that.age = age | -| | [25](https://gitee.com/level-21-software-class-4/java-script/pulls/155/files#4c54f97bde7b1ddd7cfb3625805a0ec31119e57b_0_25) | return that | -| | [26](https://gitee.com/level-21-software-class-4/java-script/pulls/155/files#4c54f97bde7b1ddd7cfb3625805a0ec31119e57b_0_26) | } | -| | [27](https://gitee.com/level-21-software-class-4/java-script/pulls/155/files#4c54f97bde7b1ddd7cfb3625805a0ec31119e57b_0_27) | | -| | [28](https://gitee.com/level-21-software-class-4/java-script/pulls/155/files#4c54f97bde7b1ddd7cfb3625805a0ec31119e57b_0_28) | 生成对象 | -| | [29](https://gitee.com/level-21-software-class-4/java-script/pulls/155/files#4c54f97bde7b1ddd7cfb3625805a0ec31119e57b_0_29) | | -| | [30](https://gitee.com/level-21-software-class-4/java-script/pulls/155/files#4c54f97bde7b1ddd7cfb3625805a0ec31119e57b_0_30) | var obj = new obj(); | -| | [31](https://gitee.com/level-21-software-class-4/java-script/pulls/155/files#4c54f97bde7b1ddd7cfb3625805a0ec31119e57b_0_31) | | -| | [32](https://gitee.com/level-21-software-class-4/java-script/pulls/155/files#4c54f97bde7b1ddd7cfb3625805a0ec31119e57b_0_32) | ## 6.2 增删查 | -| | [33](https://gitee.com/level-21-software-class-4/java-script/pulls/155/files#4c54f97bde7b1ddd7cfb3625805a0ec31119e57b_0_33) | | -| | [34](https://gitee.com/level-21-software-class-4/java-script/pulls/155/files#4c54f97bde7b1ddd7cfb3625805a0ec31119e57b_0_34) | 查:obj.name | \ No newline at end of file +| 字面量 | | +| ------ | ------------------------------ | +| | | +| | var obj = { | +| | name:value; | +| | 'String':value; | +| | } | +| | | +| | 构造函数 | +| | | +| | function GetName() { | +| | this.name = values; | +| | this.age = values; | +| | } | +| | | +| | 工厂模式(设计模式) | +| | | +| | function GetValues(name,age) { | +| | var that = { } | +| | that.name = name | +| | that.age = age | +| | return that | +| | } | +| | | +| | 生成对象 | +| | | +| | var obj = new obj(); | +| | | +| | ## 6.2 增删查 | +| | | +| | 查:obj.name | \ No newline at end of file diff --git "a/38\345\274\240\345\205\210\346\235\260/\347\254\224\350\256\260/2022-10-27js\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232.md" "b/38\345\274\240\345\205\210\346\235\260/\347\254\224\350\256\260/2022-10-27js\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232.md" new file mode 100644 index 0000000000000000000000000000000000000000..fec7dc4f08ac2d61b103e1456faca2267fe50cbc --- /dev/null +++ "b/38\345\274\240\345\205\210\346\235\260/\347\254\224\350\256\260/2022-10-27js\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232.md" @@ -0,0 +1,41 @@ +| # 7、set&map | | +| ------------ | ------------------------------------------------------ | +| | | +| | ## 7.1 map | +| | | +| | map方法 | +| | | +| | * clear: 清空 | +| | * delete: 删除 | +| | * entries: | +| | * forEach: 遍历 | +| | * get: 取值 | +| | * has: 有无 | +| | * keys: 键 | +| | * set: 添加 | +| | * size: 长度 | +| | * values: 值 | +| | | +| | 查询map | +| | | +| | for (let e of ma){ | +| | console.log(e); | +| | } | +| | | +| | WeakSet WeakMap:弱引用(直接回收),强引用(不会强制回收) | +| | | +| | map里不管是+0,0,-0,当成了同一个键(特殊) | +| | | +| | ## set | +| | | +| | set方法 | +| | | +| | * add: 添加 | +| | * clear: 清空 | +| | * delete: 删除 | +| | * entries: | +| | * forEach: 遍历 | +| | * has: 有无 | +| | * keys: 键 | +| | * size: 长度 | +| | * values: 值 | \ No newline at end of file diff --git "a/38\345\274\240\345\205\210\346\235\260/\347\254\224\350\256\260/2022-1020\347\254\254\344\272\224\346\254\241\344\275\234\344\270\232.md" "b/38\345\274\240\345\205\210\346\235\260/\347\254\224\350\256\260/2022-1020\347\254\254\344\272\224\346\254\241\344\275\234\344\270\232.md" index 9b340382db1a1a4e371a858532cf528b37aab789..f601c5ed9aabee8d60d74b940635bfefd5f3c902 100644 --- "a/38\345\274\240\345\205\210\346\235\260/\347\254\224\350\256\260/2022-1020\347\254\254\344\272\224\346\254\241\344\275\234\344\270\232.md" +++ "b/38\345\274\240\345\205\210\346\235\260/\347\254\224\350\256\260/2022-1020\347\254\254\344\272\224\346\254\241\344\275\234\344\270\232.md" @@ -1,60 +1,60 @@ -| 函数: | | | -| ----- | ------------------------------------------------------------ | ------------------------------------------------------------ | -| | [2](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_2) | 匿名函数: function (){} | -| | [3](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_3) | 箭头函数:var aa = (形参列表) => {函数体} arrow function | -| | [4](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_4) | | -| | [5](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_5) | 无返回值,一般不用箭头函数 | -| | [6](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_6) | 如果箭头函数返回一个对象,那么需要在对象外面加上括号 | -| | [7](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_7) | 例: | -| | [8](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_8) | var aa = function (n1, n2) { | -| | [9](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_9) | var sum = n1 + n2 | -| | [10](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_10) | return sum; | -| | [11](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_11) | } | -| | [12](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_12) | 箭头: | -| | [13](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_13) | var bb = (n1, n2) => { | -| | [14](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_14) | var sum = n1 + n2; | -| | [15](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_15) | return n1+n2; | -| | [16](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_16) | } | -| | [17](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_17) | var cc = (n1, n2) => n1 + n2; //函数只有一个return语句时,省略{}和return关键字,直接写返回值 | -| | [18](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_18) | 当函数只有一个形参时,可以省略圆括号 | -| | [19](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_19) | var dd = (num) => { | -| | [20](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_20) | var res = 1; | -| | [21](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_21) | for (var i = 1; i <= num; i++) { | -| | [22](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_22) | res *= i; | -| | [23](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_23) | } | -| | [24](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_24) | return console.log(res);; | -| | [25](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_25) | } | -| | [26](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_26) | | -| | [27](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_27) | var ee = () => '这是一个箭头函数'; //无参时,圆括号不可以省略 | -| | [28](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_28) | 对象: | -| | [29](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_29) | 对象: 类(人类,鱼类,鸟类) 万物对象:属性和行为 | -| | [30](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_30) | 字面量表达式创建对象 | -| | [31](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_31) | var obj = { | -| | [32](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_32) | name:{ | -| | [33](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_33) | firstName:'李', | -| | [34](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_34) | lastName:'华' | -| | [35](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_35) | }, | -| | [36](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_36) | age:18, | -| | [37](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_37) | 'qq number': 4619163491 | -| | [38](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_38) | } | -| | [39](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_39) | 属性:增删改查 | -| | [40](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_40) | | -| | [41](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_41) | 1.查 . 一级属性 二级属性往后[][] | -| | [42](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_42) | 1.1查 使用 [] | -| | [43](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_43) | console.log(obj['name']['lastName']); | -| | [44](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_44) | 增 obj.原来obj中没有的属性,相当于将该属性添加到对象obj中 | -| | [45](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_45) | obj.gender = '男' | -| | [46](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_46) | console.log(obj); | -| | [47](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_47) | | -| | [48](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_48) | 删 delete 一般删之前要对该属性进行判断 | -| | [49](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_49) | delete obj.age | -| | [50](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_50) | console.log(obj); | -| | [51](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_51) | | -| | [52](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_52) | 构造函数 = new 对象 | -| | [53](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_53) | | -| | [54](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_54) | 普通函数命名规则:小驼峰:getName() | -| | [55](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_55) | 构造函数命名规则:大驼峰:GetName() | -| | [56](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_56) | var obj = new GetName() //生成了一个对象 | -| | [57](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_57) | console.log(obj.age); | -| | [58](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_58) | | -| | [59](https://gitee.com/level-21-software-class-4/java-script/pulls/88/files#8559adefe7ff9afc844e60da73fdc07df9863d3c_0_59) | | \ No newline at end of file +| 函数: | | +| ----- | ------------------------------------------------------------ | +| | 匿名函数: function (){} | +| | 箭头函数:var aa = (形参列表) => {函数体} arrow function | +| | | +| | 无返回值,一般不用箭头函数 | +| | 如果箭头函数返回一个对象,那么需要在对象外面加上括号 | +| | 例: | +| | var aa = function (n1, n2) { | +| | var sum = n1 + n2 | +| | return sum; | +| | } | +| | 箭头: | +| | var bb = (n1, n2) => { | +| | var sum = n1 + n2; | +| | return n1+n2; | +| | } | +| | var cc = (n1, n2) => n1 + n2; //函数只有一个return语句时,省略{}和return关键字,直接写返回值 | +| | 当函数只有一个形参时,可以省略圆括号 | +| | var dd = (num) => { | +| | var res = 1; | +| | for (var i = 1; i <= num; i++) { | +| | res *= i; | +| | } | +| | return console.log(res);; | +| | } | +| | | +| | var ee = () => '这是一个箭头函数'; //无参时,圆括号不可以省略 | +| | 对象: | +| | 对象: 类(人类,鱼类,鸟类) 万物对象:属性和行为 | +| | 字面量表达式创建对象 | +| | var obj = { | +| | name:{ | +| | firstName:'李', | +| | lastName:'华' | +| | }, | +| | age:18, | +| | 'qq number': 4619163491 | +| | } | +| | 属性:增删改查 | +| | | +| | 1.查 . 一级属性 二级属性往后[][] | +| | 1.1查 使用 [] | +| | console.log(obj['name']['lastName']); | +| | 增 obj.原来obj中没有的属性,相当于将该属性添加到对象obj中 | +| | obj.gender = '男' | +| | console.log(obj); | +| | | +| | 删 delete 一般删之前要对该属性进行判断 | +| | delete obj.age | +| | console.log(obj); | +| | | +| | 构造函数 = new 对象 | +| | | +| | 普通函数命名规则:小驼峰:getName() | +| | 构造函数命名规则:大驼峰:GetName() | +| | var obj = new GetName() //生成了一个对象 | +| | console.log(obj.age); | +| | | +| | | \ No newline at end of file