diff --git "a/15\351\231\210\347\253\213\346\231\272/.keep" "b/15\351\231\210\347\253\213\346\231\272/.keep" new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git "a/15\351\231\210\347\253\213\346\231\272/\344\275\234\344\270\232/1.html" "b/15\351\231\210\347\253\213\346\231\272/\344\275\234\344\270\232/1.html" new file mode 100644 index 0000000000000000000000000000000000000000..7d4b600e7f5ad45e75093b330ca058a60073463e --- /dev/null +++ "b/15\351\231\210\347\253\213\346\231\272/\344\275\234\344\270\232/1.html" @@ -0,0 +1,61 @@ + + + + + + + Document + + + + + + \ No newline at end of file diff --git "a/15\351\231\210\347\253\213\346\231\272/\344\275\234\344\270\232/10.html" "b/15\351\231\210\347\253\213\346\231\272/\344\275\234\344\270\232/10.html" new file mode 100644 index 0000000000000000000000000000000000000000..6636c24e3e76194a50ca136be630390bfeb8cfe7 --- /dev/null +++ "b/15\351\231\210\347\253\213\346\231\272/\344\275\234\344\270\232/10.html" @@ -0,0 +1,34 @@ + + + + + + + Document + + + + +

封校三天 快乐无边

+ + + + \ No newline at end of file diff --git "a/15\351\231\210\347\253\213\346\231\272/\344\275\234\344\270\232/2.html" "b/15\351\231\210\347\253\213\346\231\272/\344\275\234\344\270\232/2.html" new file mode 100644 index 0000000000000000000000000000000000000000..957ff49c4acb6e32942af4532b38aa0ef24447bf --- /dev/null +++ "b/15\351\231\210\347\253\213\346\231\272/\344\275\234\344\270\232/2.html" @@ -0,0 +1,193 @@ + + + + + + + Document + + + + + \ No newline at end of file diff --git "a/15\351\231\210\347\253\213\346\231\272/\344\275\234\344\270\232/3.html" "b/15\351\231\210\347\253\213\346\231\272/\344\275\234\344\270\232/3.html" new file mode 100644 index 0000000000000000000000000000000000000000..845d34785a75925ddec25cef391087e31f19084f --- /dev/null +++ "b/15\351\231\210\347\253\213\346\231\272/\344\275\234\344\270\232/3.html" @@ -0,0 +1,60 @@ + + + + + + + Document + + + + + \ No newline at end of file diff --git "a/15\351\231\210\347\253\213\346\231\272/\344\275\234\344\270\232/4.html" "b/15\351\231\210\347\253\213\346\231\272/\344\275\234\344\270\232/4.html" new file mode 100644 index 0000000000000000000000000000000000000000..c08d78059728149c5351d40fbf63b515a9e878a5 --- /dev/null +++ "b/15\351\231\210\347\253\213\346\231\272/\344\275\234\344\270\232/4.html" @@ -0,0 +1,59 @@ + + + + + + + Document + + + + + \ No newline at end of file diff --git "a/15\351\231\210\347\253\213\346\231\272/\344\275\234\344\270\232/5.html" "b/15\351\231\210\347\253\213\346\231\272/\344\275\234\344\270\232/5.html" new file mode 100644 index 0000000000000000000000000000000000000000..cf8c478b36dcd0d30edb4cf4cec8bd287bba685c --- /dev/null +++ "b/15\351\231\210\347\253\213\346\231\272/\344\275\234\344\270\232/5.html" @@ -0,0 +1,152 @@ + + + + + + + Document + + + + + \ No newline at end of file diff --git "a/15\351\231\210\347\253\213\346\231\272/\344\275\234\344\270\232/6.html" "b/15\351\231\210\347\253\213\346\231\272/\344\275\234\344\270\232/6.html" new file mode 100644 index 0000000000000000000000000000000000000000..187870d7ffc0c883f71095d3f3f1fe87465ca37c --- /dev/null +++ "b/15\351\231\210\347\253\213\346\231\272/\344\275\234\344\270\232/6.html" @@ -0,0 +1,71 @@ + + + + + + + Document + + + + + \ No newline at end of file diff --git "a/15\351\231\210\347\253\213\346\231\272/\344\275\234\344\270\232/7.html" "b/15\351\231\210\347\253\213\346\231\272/\344\275\234\344\270\232/7.html" new file mode 100644 index 0000000000000000000000000000000000000000..ff42538578389cdf7ee59a0d895a078e5a22484f --- /dev/null +++ "b/15\351\231\210\347\253\213\346\231\272/\344\275\234\344\270\232/7.html" @@ -0,0 +1,35 @@ + + + + + + + Document + + + + + \ No newline at end of file diff --git "a/15\351\231\210\347\253\213\346\231\272/\344\275\234\344\270\232/8.html" "b/15\351\231\210\347\253\213\346\231\272/\344\275\234\344\270\232/8.html" new file mode 100644 index 0000000000000000000000000000000000000000..e8b27e6acb02d50f88a3c16abdd99f02256f1886 --- /dev/null +++ "b/15\351\231\210\347\253\213\346\231\272/\344\275\234\344\270\232/8.html" @@ -0,0 +1,30 @@ + + + + + + + Document + + + + + \ No newline at end of file diff --git "a/15\351\231\210\347\253\213\346\231\272/\344\275\234\344\270\232/9.html" "b/15\351\231\210\347\253\213\346\231\272/\344\275\234\344\270\232/9.html" new file mode 100644 index 0000000000000000000000000000000000000000..0b624f88fca6165b3cbbe122fd2451e932348242 --- /dev/null +++ "b/15\351\231\210\347\253\213\346\231\272/\344\275\234\344\270\232/9.html" @@ -0,0 +1,37 @@ + + + + + + + + 图片轮播 + + + + + + + + + \ No newline at end of file diff --git "a/15\351\231\210\347\253\213\346\231\272/\344\275\234\344\270\232/9_1.html" "b/15\351\231\210\347\253\213\346\231\272/\344\275\234\344\270\232/9_1.html" new file mode 100644 index 0000000000000000000000000000000000000000..bb2c653b42514042ad26acf9abbe8c87123deade --- /dev/null +++ "b/15\351\231\210\347\253\213\346\231\272/\344\275\234\344\270\232/9_1.html" @@ -0,0 +1,153 @@ + + + + + + + 4班抽卡 + + + + + +
+

软件4班全明星

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
郑玮喆庄云廖治先郑文源戴俊锋陈昊童
谢金金占志新张淑芳刘永潘廖柏成郑宗帅
李韦峰吴欣燕陈梅香陈立智袁贵森赵浩敏
林世涛罗启恒卢国建黄柱菘陈鹏张耀仁
陈华伟张正豪韦仲晓黄富贵陆建锋曾德森
吴文龙陆利群黄雄王世财张先杰胡基耀
马鑫涛李涛杨凌翔罗此东唐皓颖白婉婷
+
+ +

+
+ +
+ + + \ No newline at end of file diff --git "a/15\351\231\210\347\253\213\346\231\272/\347\254\224\350\256\260/10\345\216\237\345\236\213.md" "b/15\351\231\210\347\253\213\346\231\272/\347\254\224\350\256\260/10\345\216\237\345\236\213.md" new file mode 100644 index 0000000000000000000000000000000000000000..689e964bf9bfa94398d1268fa5fa91e9b16e26c8 --- /dev/null +++ "b/15\351\231\210\347\253\213\346\231\272/\347\254\224\350\256\260/10\345\216\237\345\236\213.md" @@ -0,0 +1,15 @@ +# 原型 + +每个构造函数都会自动生成一个prototype属性,指向一个**空对象**,这个空对象就是原型。每一个实例对象都会从原型继承属性和方法。 + +原型对象中有一个属性constructor, 它指回函数本身 + +1. 显示原型和隐式原型 + (1)每个函数function都有一个**prototype**,即显式原型(属性)(构造函数的原型) + (2)每个实例对象都有一个___**proto**___,可称为隐式原型(属性)(实例对象的原型) + (3)对象的隐式原型的值对应构造函数的显式原型的值,构造函数和实例对象之间没有直接关系 +2. 函数的prototype属性: 在定义函数时自动添加的, 默认值是一个空Object对象,对象的___**proto**___属性: 创建对象时自动添加的, 默认值为构造函数的prototype属性值 +3. 实例化:如果构造函数上与原型属性重复,优先选取构造函数的属性 +4. 函数是Function的实例 +5. Function也是个函数,它是new自身产生:Function = new Function(),所以所有函数对象的__proto__都是一样的 +6. 所有函数的显示原型prototype是new Object(),所有函数对象都是new Function()生成的 diff --git "a/15\351\231\210\347\253\213\346\231\272/\347\254\224\350\256\260/11\345\216\237\345\236\213\351\223\276.md" "b/15\351\231\210\347\253\213\346\231\272/\347\254\224\350\256\260/11\345\216\237\345\236\213\351\223\276.md" new file mode 100644 index 0000000000000000000000000000000000000000..0c1cd0fca6c4c499316ae12a8123d336aa12fad7 --- /dev/null +++ "b/15\351\231\210\347\253\213\346\231\272/\347\254\224\350\256\260/11\345\216\237\345\236\213\351\223\276.md" @@ -0,0 +1,39 @@ +## 原型链继承 + +通过实例化一个新的函数,子类的原型指向了父类的实例,子类就可以调用其父类原型对象上的私有属性和公有方法。(本质就是重写了原型对象) +## 构造函数继承 + +即在子类型构造函数的内部调用超类型构造函数。 +## 圣杯(永恒)模式 +注意!构造器归位 +圣杯模式的存在是用来继承已有原型对象 (A.prototype)中的成员(主要是公用方法), +同时根据自己的需求修改原型对象 (A.prototype)以定制符合我们要求的构造函数B,这个修改对已有的实例 (a1,a2,…)不会产生影响。 + +例子:function Parent() { + } + Parent.prototype.name = '爹'; + Parent.prototype.age = 40; + + function Child() { + } + + function inherit(Target, Origin) { + function F(){} //临时构造函数 + F.prototype = Origin.prototype; + // var f = new F();//实例化:复制一份 + // Target.prototype = f; //独立的f,里面有父类所有的属性和方法 + Target.prototype = new F(); + //归位 + //构造器归位 + Target.prototype.constructor = Target; + //超类 + Target.prototype.uber = Origin; + + } + inherit(Child, Parent); + var child = new Child(); + console.log(child.name); + console.log(Child.prototype.constructor); + var parent = new Parent(); + console.log(); + console.log(parent.name); \ No newline at end of file diff --git "a/15\351\231\210\347\253\213\346\231\272/\347\254\224\350\256\260/12\345\216\237\345\236\213\351\223\276\347\273\247\346\211\277.md" "b/15\351\231\210\347\253\213\346\231\272/\347\254\224\350\256\260/12\345\216\237\345\236\213\351\223\276\347\273\247\346\211\277.md" new file mode 100644 index 0000000000000000000000000000000000000000..f86f6fe1c2f7679d20cb4683bfb318b48f8aa716 --- /dev/null +++ "b/15\351\231\210\347\253\213\346\231\272/\347\254\224\350\256\260/12\345\216\237\345\236\213\351\223\276\347\273\247\346\211\277.md" @@ -0,0 +1,71 @@ +原型链继承 + +​ 父类中新增的实例和子类的都可以使用 +​ 可以在子类中增加实例属性,如果要新增加原型属性和方法需要在new 父类构造函数 的后面 + +例子 + +​ // function Father(){ +​ // this.say = function(){ +​ // console.log('父类'); +​ // } +​ // }; +​ // function Son(){}; +​ // Son.prototype = new Father(); +​ // var son = new Son(); +​ // son.say(); + +构造函数继承 + + 构造函数继承 + +例子 + +​ //方法都在构造函数里,不能继承原型的属性和方法,只能继承父类的实例属性和方法 +​ // function Father(){ +​ // this.say = function(){ +​ // console.log('这是父类'); +​ // } +​ // }; +​ // Father.prototype.name = '呼呼'; +​ // function Son(){ +​ // Father.call(this); +​ // }; +​ // var son = new Son(); +​ // son.say();//这是父类 +​ // console.log(son.prototype.name);//Uncaught TypeError: Cannot read properties of undefined (reading 'name') + +共享原型继承 + +例子 + +// function Father(){}; + // function Son(){}; + // function inherit(Target,Origin){ + // Target.prototype = Origin.prototype; + // } + // inherit(Son,Father); + // Father.prototype.age = 25; + // Son.prototype.age = 10; + // console.log(Father.prototype.age);//10 + // console.log(Son.prototype.age);//10 + +圣杯模式 + +例子 + + // function Father(){}; + // function Son(){}; + // function inherit(Target,Origin){ + // function F(){}; + // F.prototype = Origin.prototype; + // Target.prototype = new F(); + // Target.prototype.constructor = Target; + // Target.prototype.uber = Origin; + // } + // inherit(Son,Father); + // Father.prototype.age = 25; + // Son.prototype.age = 10; + // console.log(Father.prototype.age); + // console.log(Son.prototype.age); + diff --git "a/15\351\231\210\347\253\213\346\231\272/\347\254\224\350\256\260/13\346\255\243\345\210\231.md" "b/15\351\231\210\347\253\213\346\231\272/\347\254\224\350\256\260/13\346\255\243\345\210\231.md" new file mode 100644 index 0000000000000000000000000000000000000000..16b4839eab76eaccbc501bc84cf55b9b09b81ad8 --- /dev/null +++ "b/15\351\231\210\347\253\213\346\231\272/\347\254\224\350\256\260/13\346\255\243\345\210\231.md" @@ -0,0 +1,109 @@ +# 正则 + +正则:用来处理(匹配)字符串的;正则是单独一套语法体系; + +元字符:在正则当中有特殊语义的字符: . [] [^] ? * + {min,max} ^ $ () \1\2 | + +字符组:在固定范围内匹配一个 + +\d[0-9] \w[0-9A-Za-z_] \s[\f\n\r\t] + +.(除了转义) + +贪婪模式:能多就多 + +非贪婪模式:在正则后加?,能少就少 + +## **1.单个数字和字符的元字符** + +[范围] :匹配单个范围内的字符 +[0-9]: 匹配单个数字0-9 +[a-zA-Z0-9_] :匹配单个的数字、字母下划线 +[ ^a-z ]:匹配任意一个除括号范围内的字符 +[ ^0-9 ]:匹配任意一个非数字字符 +\w :匹配单个的数字、字母下划线 等价于 [a-zA-Z0-9] +\W :匹配单个非数字、字母下划线 +\d :匹配单个数字 等价于 [0-9] +\D :匹配单个非数字 等价于 [ ^0-9 ] + +## 2.重复匹配字符 + +x {m,n}:匹配m到n个x字符 + +x{m,}:匹配最少m个最多无限x字符 + +x{m}:必须匹配m个x字符 + +x+:匹配最少1个字符 + +x*:匹配任意x字符 + +x?:匹配0个或1个x字符 + + + +## 3.锚字符 + +^x:以x字符开头 + +x$:以x字符结尾 + +## 4.空白字符 + +\s:匹配单个空白字符 + +\S:匹配单个非空白字符 + +## 5.修饰符(没有先后顺序) + +/x/i 忽略大小写 +/x/g 全局匹配(查找所有匹配而非在找到第一个匹配后停止) +/x/m 换行匹配 + +## 6.方法test,exec + +### (1)test + +格式:正则.test(变量) + +功能:在字符串中匹配正则是否存在,有返回true,无返回false + +### (2)exec + +格式:正则.exec(变量) + +功能:在字符串中匹配正则是否存在,有返回一个数组,无返回null + +## 7.正则的字符串函数match,search,replace,split + +### match + +格式:字符串.match(正则) +功能:在字符串中匹配这个正则是否存在,**有返回**一个数组,数组放着匹配到的子串,**无返回**null + +### search + +格式:字符串.search(正则) + +功能:在字符串中,查找正则表达式,**第一次出现的位置**,**有返回**查找到的下标,**无返回**-1 + +### replace + +格式:字符串.replace(正则,替换的字符串) + +功能:在字符串找到正则,把他替换成新字符串,返回替换成功的字符串 + +### split + +格式:字符串.split(正则) + +功能:使用正则对字符串进行分割,返回分割后的数组 + + + + + + + + + diff --git "a/15\351\231\210\347\253\213\346\231\272/\347\254\224\350\256\260/14\345\274\202\345\270\270.md" "b/15\351\231\210\347\253\213\346\231\272/\347\254\224\350\256\260/14\345\274\202\345\270\270.md" new file mode 100644 index 0000000000000000000000000000000000000000..019da27845ced4716cb930dd6e11efc067f39786 --- /dev/null +++ "b/15\351\231\210\347\253\213\346\231\272/\347\254\224\350\256\260/14\345\274\202\345\270\270.md" @@ -0,0 +1,13 @@ +# 异常 + +**try……catch用于语法错误**,错误(error)有name和message两个属性。 +**throw用于逻辑错误**。 + +对于逻辑错误,js是不会抛出异常的,也就是说,用try catch没有用。这种时候,需要自己创建error对象的实例,然后用throw抛出异常 + +## try.....catch + + + +## throw + diff --git "a/15\351\231\210\347\253\213\346\231\272/\347\254\224\350\256\260/15BOM\357\274\210\346\265\217\350\247\210\345\231\250\345\257\271\350\261\241\346\250\241\345\236\213\357\274\211.md" "b/15\351\231\210\347\253\213\346\231\272/\347\254\224\350\256\260/15BOM\357\274\210\346\265\217\350\247\210\345\231\250\345\257\271\350\261\241\346\250\241\345\236\213\357\274\211.md" new file mode 100644 index 0000000000000000000000000000000000000000..1194b3824f2c6e4def75265994cd89165ff71dc0 --- /dev/null +++ "b/15\351\231\210\347\253\213\346\231\272/\347\254\224\350\256\260/15BOM\357\274\210\346\265\217\350\247\210\345\231\250\345\257\271\350\261\241\346\250\241\345\236\213\357\274\211.md" @@ -0,0 +1,116 @@ +# BOM(浏览器对象模型) + +BOM(Browser Object Model ):是浏览器对象模型,它提供了独立于内容,而**与浏览器窗口进行交互**的对象,其**核心对象是** ***\*window\**** 。 + +BOM的顶端为window + +## 1window的构成 + +(1).document + +(2).location + +(3).navigation + +(4).screen + +(5).history + +## 2.window + +### (1).常用的对象属性 + +| 属性 | 说明 | +| --------------------------------------- | ------------------------------------------------------------ | +| window | 包含了对窗口自身的引用。等价于self属性。 | +| defaultStatus | 设置或返回窗口状态栏中的默认文本。 | +| innerheight | 返回窗口的文档显示区的高度。 | +| innerwidth | 返回窗口的文档显示区的宽度。 | +| self | 返回对当前窗口的引用。等价于 Window 属性。 | +| closed | 返回窗口是否已被关闭 | +| top | 返回最顶层的先辈窗口。 | +| status | 设置窗口状态栏的文本。 | +| pageXOffset | 设置或返回当前页面相对于窗口显示区左上角的 X 位置。 | +| pageYOffset | 设置或返回当前页面相对于窗口显示区左上角的 Y 位置。 | +| parent | 返回父窗口。 | +| screenLeft,screenTop,screenX,screenY | 只读整数。声明了窗口的左上角在屏幕上的 x 坐标和 y 坐标。IE、Safari 和 Opera 支持 screenLeft 和 screenTop,而Firefox 和 Safari 支持 screenX 和 screenY。 | +| length | 设置或返回窗口中的框架数量。 | +| name | 设置或返回窗口的名称。 | +| opener | 返回对创建此窗口的窗口的引用。 | +| outerheight | 返回窗口的外部高度。 | +| outerwidth | 返回窗口的外部宽度。 | + +### (2).对象常用方法 + +| **方法** | **说明** | +| ---------------- | -------------------------------------------------- | +| onload() | 当页面完全加载到浏览器上时,触发该事件。 | +| onscroll() | 当窗口滚动时触发该事件。 | +| onresize() | 当窗口大小发生变化时触发该事件。 | +| open() | 打开一个新的浏览器窗口或查找一个已命名的窗口。 | +| **setTimeout()** | 在指定的毫秒数后调用函数或计算表达式。 | +| setInterval() | 按照指定的周期(以毫秒计)来调用函数或计算表达式。 | +| clearTimeout() | 取消由setTimeout()方法设置的定时器。 | +| vlearInterval() | 取消由setInterval()设置的定时器。 | + +## 3.document + +### (1).常用的对象属性 + +| 属性 | 方法 | +| --------------- | ---------------------------------------------------- | +| documentElement | 指向HTML页面中的元素。 | +| title | 获取文档的标题 | +| URL | 获取URL | +| domain | 取得域名,并且可以进行设置,在跨域访问中经常会用到。 | +| referrer | 取得链接到当前页面的那个页面的URL,即来源页面的URL。 | +| links | 获取文档中所有带href属性的a元素 | +| body | 指向body元素 | +| images | 获取所有img对象,返回HTMLCollection类数组对象 | +| forms | 获取所有form对象,返回HTMLCollection类数组对象 | + + + +### (2).**查找元素的方法** + +| 方法 | 说明 | +| ------------------------ | ------------------------------------------------------------ | +| **getElementById()** | 返回指定 id 的一个元素。 | +| getElementsByTagName() | 返回一个`HTMLCollection`(伪数组),包含指定标签名的所有元素。 | +| getElementsByClassName() | 返回一个HTML集合`HTMLCollection`(伪数组),包含指定类名的所有元素。 | +| document.querySelector() | 返回文档中指定的CSS选择器的第一个元素 | + +### + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git "a/15\351\231\210\347\253\213\346\231\272/\347\254\224\350\256\260/16DOM\357\274\210\346\226\207\346\241\243\345\257\271\350\261\241\346\250\241\345\236\213\357\274\211.md" "b/15\351\231\210\347\253\213\346\231\272/\347\254\224\350\256\260/16DOM\357\274\210\346\226\207\346\241\243\345\257\271\350\261\241\346\250\241\345\236\213\357\274\211.md" new file mode 100644 index 0000000000000000000000000000000000000000..0b2c77a3e8fabc36b76d8d50ee606e94937f66fd --- /dev/null +++ "b/15\351\231\210\347\253\213\346\231\272/\347\254\224\350\256\260/16DOM\357\274\210\346\226\207\346\241\243\345\257\271\350\261\241\346\250\241\345\236\213\357\274\211.md" @@ -0,0 +1,63 @@ +# DOM(文档对象模型) + +| document.documentElement | 返回文档对象(document)的根元素的只读属性(如HTML文档的 元素)。 | +| ------------------------ | ------------------------------------------------------------ | +| document.body | 返回html dom中的body节点 即 | +| document.head | 返回html dom中的head节点 即 | +| document.title | 返回html dom中的title节点 即 | + +## 1.节点(node) + +**属性:** +1.nodeType 表示节点类型 + +节点类型为1:元素节点 + +节点类型3:文本节点 + +节点类型2: 属性节点 + +2.nodeName + +该属性取决于节点类型,如果是元素类型,值为元素的标签名 + +3.nodeValue + +该属性取决于节点类型,如果是元素类型,值有null + +4.childNodes + +获取所有子节点 + +5.parentNode +指向文档树中的父节点。包含在childNodes列表中所有的节点都具有相同的父节点,每个节点之间都是同胞/兄弟节点。 + +6.previousSibling +兄弟节点中的前一个节点 + +7.nextSibling +兄弟节点中的下一个节点 + +8.firstChild +childNodes列表中的第一个节点 + +9.lastChild +childNodes列表中的最后一个节点 + +## 2.元素(elements) + +1.childElementCount + +返回该元素在HTML文档里子元素的个数 + +2.children + +返回一个数组,该数组存在该元素在HTML文档里出现的子元素 + +## 元素与节点的区别 + +所谓元素,即HTML文档里的标签,所以标签都可以称为元素,如<a>,<be>等,也就是说元素是个统称,所谓节点,即每个元素都可以称为一个节点,节点是唯一的。 + +总结:一个文档有多个元素但只有一个唯一节点。 + +比方:一个班(HTML文档)里有x人(元素)但是他们只有一个学号(节点) \ No newline at end of file diff --git "a/15\351\231\210\347\253\213\346\231\272/\347\254\224\350\256\260/1Java\345\237\272\346\234\254\346\223\215\344\275\234.md" "b/15\351\231\210\347\253\213\346\231\272/\347\254\224\350\256\260/1Java\345\237\272\346\234\254\346\223\215\344\275\234.md" new file mode 100644 index 0000000000000000000000000000000000000000..95cf21d695aa0bf9db05332c3e31b374112366e6 --- /dev/null +++ "b/15\351\231\210\347\253\213\346\231\272/\347\254\224\350\256\260/1Java\345\237\272\346\234\254\346\223\215\344\275\234.md" @@ -0,0 +1,12 @@ +1.导入js文件运行 相对路径:同一个文件夹 绝对路径:从绝对路径 2.直接嵌套进去 + +<script type="tetx/javascript"> 1.打印在控制台 var a = 5; console.log(typeof a); +2.打印在网页 document.write(typeof a); +3..弹窗输出 alert(typeof a) +4. 弹窗输入 var name = prompt('请输入一个名字') 数据类型:原始型: number, boolean, string, undefined, null (symbol) 引用型: +数组array 对象Object [[[[函数Function (map set)]]]] number: + - * / % ++,-- undefined:没有被定义, 声明了该变量 但是没有赋值 null : +声明该变量并且赋了一个空值上去 var let: let在一个作用域内只能声明一次, var可以声明多次 var 表示一个全局变量 let声明的是局部变量 条件分支if-else ++c: +在表达式之前执行自增1 c+=1 --> c==5 c++: 在表达式之后执行自增1 c == 5 --->> c+=1 双分支 if(){ }else{ } 三元运算符 (表达式) ? 满足的时候执行 : + 不满足的时候执行 var a = 90 var result = (a >= 90) ? '优秀' : '良好'; console.log(result); 条件运算 if(1表达式:结果是布尔类型){ }else if(2表达式:结果是布尔类型) +{ }else{ } while : 1.起始值 2.满足循环的条件:true:可以执行循环体 false:跳出该循环 3. 循环体 4.迭代因子 var sum = 0 while (start <= 100) { // +2.终止条件 // sum = sum + start; // if (start % 2 != 0) { // sum = sum + start; // } //4.迭代因子 //2.continue:跳出当前循环 \ No newline at end of file diff --git "a/15\351\231\210\347\253\213\346\231\272/\347\254\224\350\256\260/2\346\225\260\346\215\256\347\232\204\345\237\272\346\234\254\347\261\273\345\236\213.md" "b/15\351\231\210\347\253\213\346\231\272/\347\254\224\350\256\260/2\346\225\260\346\215\256\347\232\204\345\237\272\346\234\254\347\261\273\345\236\213.md" new file mode 100644 index 0000000000000000000000000000000000000000..06c260cc7fb823550d27703e637638e0c07f7b55 --- /dev/null +++ "b/15\351\231\210\347\253\213\346\231\272/\347\254\224\350\256\260/2\346\225\260\346\215\256\347\232\204\345\237\272\346\234\254\347\261\273\345\236\213.md" @@ -0,0 +1,70 @@ +**显示数据类型** + +``` +typeof 变量; +``` + +**数据类型转换** + +``` +//转换为数字,失败会转成NaN(非数) +var a = null; +var b = Number(a); +//转换为字符串 +var c = String(a); +//转成浮点型 +var d = parseFloat(a); +``` + +**X进制(radix)转换** + +``` +//转换为10进制 +var a = 1010; +var b = parseInt(a,16); +//转换为X进制 +var b = a.toString(radix); +``` + +**保留小数点后n位** + +``` +toFixed(n); +``` + +**判断是否是非数** + +``` +//isNaN(),是数字的话--》false 不是数字--》true +console.log(isNaN(a)); +``` + +**字符串分割** + +``` +var str = `JavaScript`; +const arr = str.split('S') //将字符串以S分割,返回是数组 +//返回结果为'Java','cript' +``` + +**Math: 舍入** + +``` +//Math.min() 取最小值 +var minnum = Math.min(1,3,5,64,76,47,84,3) +//ceil()向上取整 +var num1 = Math.ceil(53.1); //54 +//floor(向下取整) +var num2 = Math.ceil(53.1); //53 +//round(四舍五入) +var num3 = Math.ceil(53.1); //53 +``` + +**Radom() 随机数 [0,1)** + +``` +//求[0,10)随机数 +Radom()*10 +//求[20,30)随机数,[0,11)+20 --> [20,31) -->[20,30] +console.log(parseInt(Math.random()*11)+20); +``` \ No newline at end of file diff --git "a/15\351\231\210\347\253\213\346\231\272/\347\254\224\350\256\260/3\345\255\227\347\254\246\346\225\260\347\273\204.md" "b/15\351\231\210\347\253\213\346\231\272/\347\254\224\350\256\260/3\345\255\227\347\254\246\346\225\260\347\273\204.md" new file mode 100644 index 0000000000000000000000000000000000000000..fd2b5cb69310b467ef317e970a2bc7c47d3b8385 --- /dev/null +++ "b/15\351\231\210\347\253\213\346\231\272/\347\254\224\350\256\260/3\345\255\227\347\254\246\346\225\260\347\273\204.md" @@ -0,0 +1,101 @@ +## 字符&数组 + +#### 查询方法 + +``` +console.log(String.prototype); +``` + +#### 字符串转大小写 + +``` +//转大写 + 变量名.toUpperCase() +//转小写 + 变量名.toLowerCase() +``` + +#### 截取字符串 + +``` +substr(起始位置,截取个数) +// + substring(起始位置,截止位置) -- 这个好 + slice(起始位置,截止位置) + //返回值是对应长度的字符串 + //区别在于当截止位置大于起始位置时,substring会自动调换,slice只会 返回空值 +``` + +#### 去除空格 + +``` +//去除开头和结尾的空格 + 变量名.trim() +``` + +#### 判断是否包含 + +``` +//1 + 变量名.includes('要查找的字符',起始位置) + //起始位置可以不写,默认从0开始查找 + //返回布尔值 +//2 -- 爱记不记 + 变量名.indexOf('',起始位置) + //返回值是第一个匹配的下标,找不到返回-1 +``` + +### 数组 + +``` +//创建数组 + const arr1 = [值1,值2,...]; //数据类型可以不一致 + const arr2 = new Array(10); + //const -- 定义常量 +//增 + arr[n] = 'jojo'; -- 不连续 + //没填充的数据就变成empty + arr.pop(); //删除最后一个元素,先进先出(队列),下标最大的先滚 + arr.push(元素1,元素2,...); //在末尾添加元素 + arr.shift(); //移除第一个元素,后进先出(栈) + arr.unshift(); //从头添加元素 +//删 + delete arr[n] -- 不好用 +//改 + arr[n] = 'FF'; -- 直接覆盖 +//查 + arr[index] +//排序 -- 没啥用 + arr.sort(arr); //按照1234...abc...的顺序排,不按大小 +//反转数组顺序 + arr.reverse(); +//嫁接 -- 要记 + arr.splice(起始位置,要删除的个数,要嫁接的值); +``` + +#### 数组解构 + +``` +const arr = [1,2,3,4]; +var [a,b,c,d] = arr; +//相当于 var a = arr[0],... +//如果要省略其中一个 +var [a,,c,d] = arr; --省略了2 +//只想要一个元素 +var [a,...args] = arr; +//...args 剩余运算符,将剩余运算符装到args数组里 +``` + +#### 冒泡排序 + +``` +for(let i = 0; i<arr.length-1;i++){ + for(let j = 0; j<arr.length-1-i;j++){ + if(arr[j]>arr[j+1]){ + let temp = arr[j]; + arr[j] = arr[j+1]; + arr[j+1] = temp; + } + } +} +``` \ No newline at end of file diff --git "a/15\351\231\210\347\253\213\346\231\272/\347\254\224\350\256\260/4\345\207\275\346\225\260\345\257\271\350\261\241.md" "b/15\351\231\210\347\253\213\346\231\272/\347\254\224\350\256\260/4\345\207\275\346\225\260\345\257\271\350\261\241.md" new file mode 100644 index 0000000000000000000000000000000000000000..3f25e3abcbcd5ef107b7020afaf80b7f9f98fa98 --- /dev/null +++ "b/15\351\231\210\347\253\213\346\231\272/\347\254\224\350\256\260/4\345\207\275\346\225\260\345\257\271\350\261\241.md" @@ -0,0 +1,60 @@ +## 箭头函数,对象 + +### 匿名函数 + +``` + function (){ + ...; + return ...; + } +``` + +### 箭头函数 + +``` +var aa = (形参列表) => {函数体} +//形参或者函数体只有一个和一句时,可以省略括号 +//无参时,括号不可省略 +//无返回值,一般不用箭头函数 +``` + +### 构造函数 + +``` +//普通函数命名规则:小驼峰:getName() +//构造函数命名规则:大驼峰:GetName() +function GetName(){ + this.name = 'FF' + this.age = 18 +}; +``` + +### 创建对象 + +``` +//字面量表达式创建对象(字面量:描述自己的量) +var obj = { + name:{ + Name:'Jo', + lastName:'Jo' + }, + age:18 +} +// +var obj = new GetName() +``` + +### 对象--增删改查 + +``` +//查 . 一级属性 二级属性往后[][] +console.log(obj.name); +//查 使用 [] +console.log(obj['name']['lastName']); + +//增 obj. --直接赋值 原来obj中没有的属性,相当于将该属性添加到对象obj中 +obj.gender = '男' + +//删 delete 一般删之前要对该属性进行判断 +delete obj.age +``` \ No newline at end of file diff --git "a/15\351\231\210\347\253\213\346\231\272/\347\254\224\350\256\260/5\345\214\205\350\243\205\347\261\273.md" "b/15\351\231\210\347\253\213\346\231\272/\347\254\224\350\256\260/5\345\214\205\350\243\205\347\261\273.md" new file mode 100644 index 0000000000000000000000000000000000000000..1199dfc7619acf93463e2a0aa838206db21b1c02 --- /dev/null +++ "b/15\351\231\210\347\253\213\346\231\272/\347\254\224\350\256\260/5\345\214\205\350\243\205\347\261\273.md" @@ -0,0 +1,21 @@ +# 包装类 + +## 1.定义方法更新记录: + + function updateRecords(id, prop, value) //id :5439 props:属性 value:值 + +​ 要求: + + (1).如果传入的value是一个空值,表示将该属性删除 + + (2).传入的prop如果是tracks,则代表添加,其他是修改 + +2.assign:拷贝,浅拷贝(复制的是对象的地址),(手写一个对象的深拷贝)深拷贝(复制的的对象本身),assign:1.浅拷贝一个对象 2.合并对象(target,sources....) + +## 2.包装类 + +原始数据类型: number, boolean, string, null, undefined (symbol,bigint) + +包装类只有:number,boolean,string。 null,undefined是没有包装类的 + +包装类的概念:通常情况下基本数据类型的变量不是对象,为了满足万物皆对象的理念就需要对基本数据类型的变量进行打包封装处理变成对象,而负责将这些变量声明为成员变量进行对象化处理的相关类,叫做包装类。 \ No newline at end of file diff --git "a/15\351\231\210\347\253\213\346\231\272/\347\254\224\350\256\260/6Map.md" "b/15\351\231\210\347\253\213\346\231\272/\347\254\224\350\256\260/6Map.md" new file mode 100644 index 0000000000000000000000000000000000000000..c79dc0bd927b6e40443f588afe8a3427dba55892 --- /dev/null +++ "b/15\351\231\210\347\253\213\346\231\272/\347\254\224\350\256\260/6Map.md" @@ -0,0 +1,111 @@ +# 一 Map + +Map:键值对,类似于对象,键是唯一的 + +创建map + +var 变量名n=new map() 注:变量名n是一个对象 + +## 1.map增加 + +create + +变量名n.set(键,值) + +## 2.map删除 + +delete + +var 变量名n=map.delete(键)注:返回为布尔值 + +## 3.map改 + +变量名n.set(要改的键,新值) + +## 4.map查 + +1.keys只返回键 + +for (let e of map名.keys()){ + +​ console.log(e); + +} + +---------------------------- + +2.values只返回值 + +for (let e of map名.values()){ + +​ console.log(e); + +} + +---------------------------------------------------- + +3.entrise返回数组 + +for (let e of map名.entries()){ + +​ console.log(e); + +} + +--------------------------------------- + +4.返回所有 + +for (let e of map名){ + +​ console.log(e); + +} + +## 5.map转数组 + +const arr = [...map名] + +for(let e of map.entries()){ + +arr.push(e) + +} + +## 6.数组转map + +const 数组名 = [[键, 值], ['name', 18]] + +var map = new Map([['键', '值'], ['age', 18]]) + +# 二 set数组 + +set:(装不重复的元素)数组 + +## 1.创建set + +var 变量名 = new Set(); + +## 2.set增加 + +set.add(值) + +## 3.set删除 + +set.delete(已有值) + +## 4.set查 + +注:与map方法一致查看上面 + +## 5.set转数组 + +const 数组名 = [...set名] + +## 6.数组转set(数组去重) + + var set名 = new Set(数组名); + +三 WeakSet WeakMap:弱引用(直接回收),强引用(不会强制回收) + +var weakset = new WeakSet() \ No newline at end of file diff --git "a/15\351\231\210\347\253\213\346\231\272/\347\254\224\350\256\260/7\351\242\204\347\274\226\350\257\221.md" "b/15\351\231\210\347\253\213\346\231\272/\347\254\224\350\256\260/7\351\242\204\347\274\226\350\257\221.md" new file mode 100644 index 0000000000000000000000000000000000000000..e6767f12dc34f134151f9571edd55e32bb6ade2e --- /dev/null +++ "b/15\351\231\210\347\253\213\346\231\272/\347\254\224\350\256\260/7\351\242\204\347\274\226\350\257\221.md" @@ -0,0 +1,55 @@ + //预编译 : 预编译分为全局预编译和函数预编译 + //全局预编译:在网页加载完成时执行 + //函数预编译:函数执行的前一刻执行 + //全局预编译步骤: + //创建GO(Global Object,全局执行期上下文,在浏览器中为window)对象; + //寻找var变量声明,并赋值为undefined; + //寻找function函数声明,并赋值为函数体; + //执行代码。 + + // GO{ + //x:u + //y:4 + //z:u + //add:f add(){return n = n + 1} => f add(){ return n = n + 3} + // } + // var x = 1, + // y = z = 0; + + // function add(n) { + // return n = n + 1; + // } + + // y = add(x); //4 + // function add(n) { + // return n = n + 3; + // } + + // z = add(x); //4 + + //函数预编译步骤: + //创建AO对象 + //寻找函数的形参和变量声明,将变量和形参名作为AO对象的属性名,值设定为undefined. + //将形参和实参相统一,即更改形参后的undefined为具体的形参值。 + //寻找函数中的函数声明,将函数名作为AO属性名,值为函数体。 + + //AO{ + //a:u + //b:u + //} + function fn(a) { + console.log(a); //u + var a = 123; + console.log(a); //123 + + function a() { }; + console.log(a); //123 + + var b = function () { }; + console.log(b); // f(){} + + function d() { }; + } + + + fn(1); \ No newline at end of file diff --git "a/15\351\231\210\347\253\213\346\231\272/\347\254\224\350\256\260/8\351\227\255\345\214\205.md" "b/15\351\231\210\347\253\213\346\231\272/\347\254\224\350\256\260/8\351\227\255\345\214\205.md" new file mode 100644 index 0000000000000000000000000000000000000000..00b124749fe3ed1441a8d99e5602e9f78e70ffc6 --- /dev/null +++ "b/15\351\231\210\347\253\213\346\231\272/\347\254\224\350\256\260/8\351\227\255\345\214\205.md" @@ -0,0 +1,86 @@ + //闭包 = 内层函数 + 引用的外层函数变量 + //当外部想要使用闭包的变量时,需要return + // function outer(){ + // var a = 10; + // return function(){ + // console.log(a); + // } + // } + // var fn = outer(); + // fn(); + + //函数内部可以访问外部的全局变量 + //函数外部无法读取函数内部的变量 + // let age = 10; + // function huhu(){ + // console.log(age); + // } + // huhu(); + + //链式作用域结构 + //首先子对象会在自身的作用域寻找变量,如果没有则一层一层的向父级寻找。、 + // var name = '小明' + // function man() { + // console.log(name) + // var age = '20'; + // (function getage() { + // console.log(age) + // }()) + // } + // man() + + //闭包的作用 + //访问局部变量 + // function man(){ + // var age = 20; + // return function(){ + // console.log(age); + // } + // } + // //console.log(age); //报错 + // var huhu = man(); + // huhu(); + + //保存局部变量 + //因为垃圾回收机制的存在,函数执行完成后里面的局部变量会被销毁 + // function get(){ + // var num = 0; + // return function(){ + // console.log(num++); + // } + // } + // var aa = get(); + // aa(); // 0 + // aa(); // 1 + + //实现类的封装 + // function man(){ + // var name = '小明'; + // var age = 15; + // return { + // getName : function (){ + // console.log(name); + // }, + // setName : function (newName){ + // name = newName; + // } + // } + // } + // var huhu = new man(); + // huhu.getName(); + // huhu.setName('张三'); + // huhu.getName(); + + //注意点:内存泄漏 (正常情况下,因为垃圾回收机制,局部变量在函数执行完毕之后其生命周期也结束, + //所以内存会被回收释放。但是因为我们使用了闭包,导致变量一直保存在内存,无法得到释放,造成内存的消耗。) + //退出函数前,将不使用的局部变量删除,或者解除函数的引用 + // function num(){ + // var num = 0; + // return function(){ + // console.log(num++); + // } + // } + // var huhu = num(); + // huhu(); + // huhu(); + // huhu = null; //解除函数的引用,此时变量num释放 \ No newline at end of file diff --git "a/15\351\231\210\347\253\213\346\231\272/\347\254\224\350\256\260/9\344\270\245\346\240\274\345\207\275\346\225\260.md" "b/15\351\231\210\347\253\213\346\231\272/\347\254\224\350\256\260/9\344\270\245\346\240\274\345\207\275\346\225\260.md" new file mode 100644 index 0000000000000000000000000000000000000000..98246c941cc7930e069c4a6226d60000e1aee5f1 --- /dev/null +++ "b/15\351\231\210\347\253\213\346\231\272/\347\254\224\350\256\260/9\344\270\245\346\240\274\345\207\275\346\225\260.md" @@ -0,0 +1,80 @@ +严格函数 + +​ arguments:伪数组,只有下标,长度,元素是实参的映射 + +改变this指向 + +​ // 函数被执行时,内部会产生一个this + +``` + // window.getNum(); +``` + +严格模式:防止意外发生错误时,及时抛出该错误 + +​ 1.在严格模式下,函数内部不会再意外地生成全局变量,而是抛出异常 + +例题: + +``` +function getName(a,b,a){ + 'use strict' + console.log(a); + a = 5; + + } + getName(1,3,5); + console.log(a); +``` + + + +​ 2.严格模式要求一个对象内的所有属性名在对象内必须唯一 + +例题: + +``` +"use strict" + var obj = { + a:1, + a:2, + b:4 + } + console.log(obj.a); + + function Product(name, price) { + 'use strict' + console.log(this); //null Prodcut Window + this.name = name; + this.price = price; + } +``` + +​ 3.call(null) call(undefined):严格模式下会抛出错误,非严格模式会自动转换全局 + +例题: + +``` +Product.call(undefined, '张三', 15) +``` + +​ 4.构造函数使用严格模式,必须使用new + +例题: + +``` +function Product(name, price) { + 'use strict' + this.name = name; + this.price = price; + } + new Product('张三',18); +``` + +​ 构造函数:Person( ); + +​ 普通函数小驼峰:getNameAge; + +​ 普通变量: personAge person_age; + +​ 常量:Pl \ No newline at end of file