diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\345\205\253\345\221\250/.keep" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\345\205\253\345\221\250/.keep" new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\345\205\253\345\221\250/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\345\205\253\345\221\250_\347\254\254\344\270\200\350\212\202/.keep" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\345\205\253\345\221\250/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\345\205\253\345\221\250_\347\254\254\344\270\200\350\212\202/.keep" new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\345\205\253\345\221\250/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\345\205\253\345\221\250_\347\254\254\344\270\200\350\212\202/week20_1practice.js" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\345\205\253\345\221\250/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\345\205\253\345\221\250_\347\254\254\344\270\200\350\212\202/week20_1practice.js" new file mode 100644 index 0000000000000000000000000000000000000000..4a87169e210d93220592127001a5d2dd12f9a865 --- /dev/null +++ "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\345\205\253\345\221\250/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\345\205\253\345\221\250_\347\254\254\344\270\200\350\212\202/week20_1practice.js" @@ -0,0 +1,51 @@ +a = 1 +1 +var a = 1 +undefined +let a = 1 +undefined +a +1 +const NAME = "tuann" +undefined +NAME = "chihahi" +function foo(){ + let a = 2; + let b; + return a=3, b=4, b +} +undefined +foo() +4 +Math.random() +0.3633741885409343 +parseInt(Math.random()*100) +48 +parseInt(Math.random()*100) +40 +maxNum = 90 +90 +minNum = 20 +20 +parseInt(Math.random()*(maxNum-minNum)) + minNum +81 +parseInt(Math.random()*(maxNum-minNum)) + minNum +43 +parseInt(Math.random()*(maxNum-minNum)) + minNum +79 +parseInt(Math.random()*(maxNum-minNum)) + minNum +22 +foo = (function(minNum, maxNum){ + console.log(parseInt(Math.random()*(maxNum-minNum)) + minNum) +}) +ƒ (minNum, maxNum){ + console.log(parseInt(Math.random()*(maxNum-minNum)) + minNum) +} +console.log(foo) +VM3451:1 ƒ (minNum, maxNum){ + console.log(parseInt(Math.random()*(maxNum-minNum)) + minNum) +} +undefined +foo = (function(minNum, maxNum){ + console.log(parseInt(Math.random()*(maxNum-minNum)) + minNum) +})(minNum:20 , maxNum:90) \ No newline at end of file diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\345\205\253\345\221\250/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\345\205\253\345\221\250_\347\254\254\344\270\211\350\212\202/.keep" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\345\205\253\345\221\250/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\345\205\253\345\221\250_\347\254\254\344\270\211\350\212\202/.keep" new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\345\205\253\345\221\250/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\345\205\253\345\221\250_\347\254\254\344\270\211\350\212\202/week20_3practice.js" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\345\205\253\345\221\250/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\345\205\253\345\221\250_\347\254\254\344\270\211\350\212\202/week20_3practice.js" new file mode 100644 index 0000000000000000000000000000000000000000..41469db76c4b6194c06ddab91d464767ff8c942d --- /dev/null +++ "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\345\205\253\345\221\250/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\345\205\253\345\221\250_\347\254\254\344\270\211\350\212\202/week20_3practice.js" @@ -0,0 +1,61 @@ +//数据类型的CURD +//字符串 +s = 'abc' //单引号 +s = "abc" //双引号 +s = `abc +aa` //如果有特殊的空白字符,使用``符号 +//合并字符串 +s += '2' +string.length //获取字符串的长度 +myString[index] //通过索引获取单个字符 +myString.slice[start, end] //切片获取子字符串 +myString.indexOf("a") +//在js中判断当前字符是否在字符串中,会通过一下方式 +if(-myString.index("a")){ + +} + +s.replace("object", "test") +s.replaceAll //替换所以匹配的子字符串 + +//Delete +let s = "test" +`get string => ${s}` +>>"get string => test" + +//数组 +let myArray = [1, 2, 3] +let myArray2 = Array.from(myArray) //复制一个数组 +let myArray3 = myArray.concat(myArray2) //合并两个数组 + +myArray.length //查看数组的长度 +myArray.[index] //通过索引获取单个元素 +myArray.slice(start, end) //通过切片获取子数组 +myArray.indexOf(value) //通过元素获取当前索引值 + +myArray[index] = newvalue //通过索引值进行元素替换 超过索引值不会报错 +myArray.push('c') //在数组尾部加元素 +myArray.splice(1, 0, 'd') + +myArray.splice(5, 100) //通过索引值删除,第二个元素如果有值则代表删除 +myArray.pop() // 从数组尾部删除元素 +//排序 +myArray.reverse() //倒序 +myArray.sort() //排序 +//对象 +let myObj = {'a':1, 'b':2} +let myObj2 = {'c':1, "d":4} +Object.assign(myObj, myObj2) //合并对象 +Object.key(myObj) //获取当前对象所以的key +Object.values(myObj) //获取当前对象所有的values +Object.defineProperty(navigator, 'webdriver',{value:true, writable:true}) //键对值赋值 + +delete myObj.a //删除 +JSON.stringify(myObj) //json转换 object > string +let jsonDate = JSON.stringify(myObj) +JSON.parse(jsonDate) //string >object + +//date模块操作 +new Date() //获取当前时间 +new Date().toISOString() //时间格式化 +new Date().getTime() //精确到毫秒 \ No newline at end of file diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\345\205\253\345\221\250/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\345\205\253\345\221\250_\347\254\254\344\272\214\350\212\202/.keep" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\345\205\253\345\221\250/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\345\205\253\345\221\250_\347\254\254\344\272\214\350\212\202/.keep" new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\345\205\253\345\221\250/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\345\205\253\345\221\250_\347\254\254\344\272\214\350\212\202/week20_2practice.js" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\345\205\253\345\221\250/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\345\205\253\345\221\250_\347\254\254\344\272\214\350\212\202/week20_2practice.js" new file mode 100644 index 0000000000000000000000000000000000000000..2b1d55f83d588626c472152463f5bf920cffd472 --- /dev/null +++ "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\345\205\253\345\221\250/3\347\217\255_\351\231\266\345\206\266_\347\254\254\345\215\201\345\205\253\345\221\250_\347\254\254\344\272\214\350\212\202/week20_2practice.js" @@ -0,0 +1,57 @@ +//命名规范: 类和构造函数使用大驼峰命名法 +function Dog (){ + this.color = 'black' +} +// 私有属性用_表示 +function Dog (){ + this.color = 'black' + this._owner = 'tunan' +} +//单行注释 +/* 多行注释 +* +* */ +//基本数据类型 1,undefined +typeof False +"undefined" // 返回undifined的原因是js中false是小写的 +//基本数据类型 2,boolean +typeof false +//基本数据类型 3,number +typeof 1 +typeof 1.0 +//基本数据类型 4,Bigint +typeof 1n + +//基本数据类型 5,String +typeof '2' +//基本数据类型 6,Symbol +a = Symbol(1) +b = Symbol(2) +a === b +>false +//基本数据类型 7,null +// null和undefined区别:null表示一个空指针,undefined表示‘无0这样一个值’ +//基本数据类型 8,Object 一种类似字典,用键对值表示属性关系的数据类型,键是字符串或者Symbol +let obj = {undefined: 1 , false: 2 , 1:3 , 1n:4 , '1':5} + +//基本数据类型 9,Function + +//基本数据结构 1,对象 --表面像字典,本质和python中类相似 +let obj = {undefined: 1 , false: 2 , 1:3 , 1n:4 , '1':5} //直接声明 +//通过new一个对象 +function Dog(){ + this.color = 'balck' +} +new Dog() + +//基本数据结构 2,数组 --类似python中的list,但是扩容机制有区别 +let myArray = [1,2] +myArray[3] = 'a' +//Uint8Array -表示8位无符号正兴数组 +let myArray = new Uint8Array() +//Uint16Array Uint32Array +//基本数据结构 Map --认为是有序的字典 +let myMap = new Map() +//基本数据结构 Set +let mySet = new Set +