diff --git "a/\346\234\261\347\276\216\346\236\227/20220517\346\225\260\347\273\204\345\216\273\351\207\215\345\207\240\347\247\215\346\226\271\346\263\225/arrFilter.js" "b/\346\234\261\347\276\216\346\236\227/20220517\346\225\260\347\273\204\345\216\273\351\207\215\345\207\240\347\247\215\346\226\271\346\263\225/arrFilter.js" new file mode 100644 index 0000000000000000000000000000000000000000..e44ee686dca535c9556bc3188278671843c47e31 --- /dev/null +++ "b/\346\234\261\347\276\216\346\236\227/20220517\346\225\260\347\273\204\345\216\273\351\207\215\345\207\240\347\247\215\346\226\271\346\263\225/arrFilter.js" @@ -0,0 +1,65 @@ +let arr=[1,2,2,3,4,6,9,10,9,8,20]; + newArr=[] +// 第一种暴力双循环重复法 +// for(let i=0;i{ +// if(newArr.indexOf(val)<0){ +// newArr.push(val) +// } +// }) + +// sort()排序法(不常用?) +// arr=arr.sort(); +// for(let i=0;i1){ +// if(arr[index]==arr[index-1]){ +// arr.splice(index,1) +// } +// index--; +// loop(index) +// } +// } +// loop(arr.length-1); +// console.log(arr); + +// +// arr.forEach(el=>{ +// if(arr.indexOf(el)!=-1){ +// arr.push(el) +// } +// }) + +//keys diff --git "a/\346\234\261\347\276\216\346\236\227/20220518\345\255\227\347\254\246\344\270\262\344\275\234\344\270\232/\345\237\272\347\241\200\346\225\260\346\215\256\347\261\273\345\236\213.html" "b/\346\234\261\347\276\216\346\236\227/20220518\345\255\227\347\254\246\344\270\262\344\275\234\344\270\232/\345\237\272\347\241\200\346\225\260\346\215\256\347\261\273\345\236\213.html" new file mode 100644 index 0000000000000000000000000000000000000000..681b89206679ba76c1346c07e1367cfdbecdc2db --- /dev/null +++ "b/\346\234\261\347\276\216\346\236\227/20220518\345\255\227\347\254\246\344\270\262\344\275\234\344\270\232/\345\237\272\347\241\200\346\225\260\346\215\256\347\261\273\345\236\213.html" @@ -0,0 +1,90 @@ + + + + + + + + Document + + + + + + + + \ No newline at end of file diff --git "a/\346\234\261\347\276\216\346\236\227/20220518\345\255\227\347\254\246\344\270\262\344\275\234\344\270\232/\345\237\272\347\241\200\346\225\260\346\215\256\347\261\273\345\236\213.md" "b/\346\234\261\347\276\216\346\236\227/20220518\345\255\227\347\254\246\344\270\262\344\275\234\344\270\232/\345\237\272\347\241\200\346\225\260\346\215\256\347\261\273\345\236\213.md" new file mode 100644 index 0000000000000000000000000000000000000000..ab30135e4dbf472b2f917c8a54b60b1291779a28 --- /dev/null +++ "b/\346\234\261\347\276\216\346\236\227/20220518\345\255\227\347\254\246\344\270\262\344\275\234\344\270\232/\345\237\272\347\241\200\346\225\260\346\215\256\347\261\273\345\236\213.md" @@ -0,0 +1,117 @@ +**undefined** + +申明了变量,但是没赋值, + +``` +let num; + +console.log(num); + +if(num){//转化为false + // + console.log(111);//不执行 +} + +``` + +**null** + +表示没值 +``` +let num = null; + +console.log(typeof num);//输出的是object,js的bug,js 认为null是空对象指针 + +if(num){//转为false + +} + +``` +**boolean** + +真假,true 和 false ,大写不行(True 于 False) + +**string** + +js字符串使用 unicode 存储,2个字节 + +``` +let st1='1111' +let st2 = '中文a' +console.log(st2.length); //3 || 7 length 指的是字符的个数 + +``` + +有哪些函数与属性? + +``` +// legth 返回字符个数 + +// indexOf 在字符串中查找指定的字符串,如果存在返回下标,如果不存在返回 -1 + +// lastIndexOf + +// split 分割转化为数组 + +// charAt 返回指定位置的字符 + +// subStr 截取字符串 + +// join 数组转为字符串 + +``` + +字符串可以按数组的方式去访问. + +**Number** + +包含了 整数,浮点 + +Number 有上限吗?有 Number.MAX_VALUE + +``` +//浮点是不精确的,跟语言无关 +console.log(0.1+0.2);// +//把其它数据类型转成number +let numstr='101';// parseInt,number + + +``` + +**哪些情况下会转为true 与false** + +``` +let num; +if(num){//转为false + +} + +num=0 + +if(num){//false + +} + +num='0'; + +if(num){//0的字符串转化为true + +} + +let str='';//转为false + +let num11 = 'ASS'; + +if (Number(num11)) {// Nan 转为false + console.log('Nan true 或是 false') +} + + + +``` + +**作业:讲过的写写,有时间的看看 java,vue** + + + + diff --git "a/\346\234\261\347\276\216\346\236\227/20220519\345\274\225\347\224\250\346\225\260\346\215\256\347\261\273\345\236\213-array\345\223\207/1.html" "b/\346\234\261\347\276\216\346\236\227/20220519\345\274\225\347\224\250\346\225\260\346\215\256\347\261\273\345\236\213-array\345\223\207/1.html" new file mode 100644 index 0000000000000000000000000000000000000000..c490229cb02abd38b6538259600d8a6db4e8517e --- /dev/null +++ "b/\346\234\261\347\276\216\346\236\227/20220519\345\274\225\347\224\250\346\225\260\346\215\256\347\261\273\345\236\213-array\345\223\207/1.html" @@ -0,0 +1,86 @@ + + + + + + + + Document + + + + + + + + \ No newline at end of file diff --git "a/\346\234\261\347\276\216\346\236\227/20220519\345\274\225\347\224\250\346\225\260\346\215\256\347\261\273\345\236\213-array\345\223\207/\345\274\225\347\224\250\346\225\260\346\215\256\347\261\273\345\236\213array.md" "b/\346\234\261\347\276\216\346\236\227/20220519\345\274\225\347\224\250\346\225\260\346\215\256\347\261\273\345\236\213-array\345\223\207/\345\274\225\347\224\250\346\225\260\346\215\256\347\261\273\345\236\213array.md" new file mode 100644 index 0000000000000000000000000000000000000000..b35798a31409e5a748c32c128aa31e096ff5a2ad --- /dev/null +++ "b/\346\234\261\347\276\216\346\236\227/20220519\345\274\225\347\224\250\346\225\260\346\215\256\347\261\273\345\236\213-array\345\223\207/\345\274\225\347\224\250\346\225\260\346\215\256\347\261\273\345\236\213array.md" @@ -0,0 +1,116 @@ +**有哪些引用类型** + +数组,Object,函数,Date,Boolean,String,Math,Reg,Class + + +**引用类型的赋值与基础数据类型的差异** +``` +let obj ={ + study:'web 前端', + age:15 +}; + +let obj2=obj; + +obj2.age=20; + +console.log(obj.age) + + + let num1=10; + let num2=num1; + num2=20; + console.log(num1); + + +栈区(速度快,空间小) 堆区(空间大) + +变量名 具体值 内存位置 +//基础数据类型 //基础数据类型,不只想堆区 +num1 10 无联系 +num2 20 无联系 +//引用类型 //引用类型 +obj 堆区的地址 001 0001{ + study:'web 前端', + age:20, + } + +obj2 堆区的地址 001 + + + +``` + + +**数组** + +可以存储各种类型的数据 + +### 数组的申明 +``` +let arr = []; + +let arr1 = new Array(); + +``` + +### 关键函数 + +``` + +let arr=['js','vue','css3']; +//数组转字符串 +arr.join(','); +//数组的合并 +let arr2 =['java','c++']; +let arr3=arr2.concat(arr); +//去重 +let arr5=[] +arr3.forEach(el=>{ + if(arr5.indexOf(el)==-1){ + arr5.push(el) + } +}) +console.log(arr5); +//是否包含元素 +indexOf + +//keys 返回数组的下标,会转成字符串的数组 +Object.keys(arr3) + +//values 返回数组的值,下表会自动从0 开始生成 +Object.values(arr3) + +//sort 排序 +默认排序顺序是在将元素转换为字符串,然后比较它们的UTF-16代码单元值序列时构建的 +如果 compareFunction(a, b) 小于 0 ,那么 a 会被排列到 b 之前; +如果 compareFunction(a, b) 等于 0 , a 和 b 的相对位置不变。备注: ECMAScript 标准并不保证这一行为,而且也不是所有浏览器都会遵守(例如 Mozilla 在 2003 年之前的版本); +如果 compareFunction(a, b) 大于 0 , b 会被排列到 a 之前。 +compareFunction(a, b) 必须总是对相同的输入返回相同的比较结果,否则排序的结果将是不确定的 + + let arr7=[9,10,1,4,7]; + let arr8=arr7.sort(); + console.log(arr8) + console.log(arr7) + let arr9 = arr7.sort((a,b)=>{ + return a-b; + }) + console.log(arr9) + +//pop 弹出,会把数组的最后一个数据弹出,意味着有返回值,数组会相应的减少弹出的元素. + let arr10=['java','js','python'] + let num=arr10.pop(); + console.log(num); + console.log(arr10); + +//shift() 方法从数组中删除第一个元素,并返回该元素的值。此方法更改数组的长度. + + + + +``` + + + + + diff --git "a/\346\234\261\347\276\216\346\236\227/20220520datemvvm\346\240\270\345\277\203\345\216\237\347\220\206defineProperty/date.html" "b/\346\234\261\347\276\216\346\236\227/20220520datemvvm\346\240\270\345\277\203\345\216\237\347\220\206defineProperty/date.html" new file mode 100644 index 0000000000000000000000000000000000000000..751d0e490717bf86a8a1093a51b789327834b5fe --- /dev/null +++ "b/\346\234\261\347\276\216\346\236\227/20220520datemvvm\346\240\270\345\277\203\345\216\237\347\220\206defineProperty/date.html" @@ -0,0 +1,70 @@ + + + + + + + Document + + + + + \ No newline at end of file diff --git "a/\346\234\261\347\276\216\346\236\227/20220520datemvvm\346\240\270\345\277\203\345\216\237\347\220\206defineProperty/date.md" "b/\346\234\261\347\276\216\346\236\227/20220520datemvvm\346\240\270\345\277\203\345\216\237\347\220\206defineProperty/date.md" new file mode 100644 index 0000000000000000000000000000000000000000..070f3cdc44c8757ed15d2e1f54fcf93cf343e00d --- /dev/null +++ "b/\346\234\261\347\276\216\346\236\227/20220520datemvvm\346\240\270\345\277\203\345\216\237\347\220\206defineProperty/date.md" @@ -0,0 +1,30 @@ +**date** + +创建对象 new Date();不给参数,返回的是当前的事件对象,如果给定了参数,会返回改参数的对象 + +四种构造方法 + +new Date();//空参数 +new Date(value);//时间戳 +new Date(dateString);//日期格式 +new Date(year, monthIndex [, day [, hours [, minutes [, seconds [, milliseconds]]]]]); + +什么是时间戳? + +``` +//获取时间戳,返回毫秒数 +new Date().getTime(); + +//获取我们看得懂时间的字符串 + + +``` + +**vue mvvm的核心原理** + +Object.defineProperty +方法会直接在一个对象上定义一个新属性,或者修改一个对象的现有属性,并返回此对象。 + +``` + + diff --git "a/\346\234\261\347\276\216\346\236\227/20220520datemvvm\346\240\270\345\277\203\345\216\237\347\220\206defineProperty/formattime.js" "b/\346\234\261\347\276\216\346\236\227/20220520datemvvm\346\240\270\345\277\203\345\216\237\347\220\206defineProperty/formattime.js" new file mode 100644 index 0000000000000000000000000000000000000000..95a842a755fceb7aac90423abc0396441d05b174 --- /dev/null +++ "b/\346\234\261\347\276\216\346\236\227/20220520datemvvm\346\240\270\345\277\203\345\216\237\347\220\206defineProperty/formattime.js" @@ -0,0 +1,13 @@ +//获取当前月份最后一天的23:59:59:00的时间戳 + + + //作业:获取当前月份最后一天的 23:59:59 的时间戳 + // 友情提示: 如果为 dayValue 指定0,那么日期就会被设置为上个月的最后一天, + // setMonth 操作也是类似的 + + // console.log(new Date().setDate(0)); + + let date1=new Date(); + let datestr=date1.getFullYear()+'-'+(date1.getMonth()+2)+'-'+'1'; + //console.log(datestr); + console.log(new Date(datestr).getTime()-1); diff --git "a/\346\234\261\347\276\216\346\236\227/20220520datemvvm\346\240\270\345\277\203\345\216\237\347\220\206defineProperty/mvvm\345\216\237\347\220\206.html" "b/\346\234\261\347\276\216\346\236\227/20220520datemvvm\346\240\270\345\277\203\345\216\237\347\220\206defineProperty/mvvm\345\216\237\347\220\206.html" new file mode 100644 index 0000000000000000000000000000000000000000..c4c7ebc9fac54df18fb4acf63f262bbb6a0cf8b9 --- /dev/null +++ "b/\346\234\261\347\276\216\346\236\227/20220520datemvvm\346\240\270\345\277\203\345\216\237\347\220\206defineProperty/mvvm\345\216\237\347\220\206.html" @@ -0,0 +1,98 @@ + + + + + + + + Document + + + + + + + \ No newline at end of file