From a0c863dadc56df1886fb890aaaaf55521c37a4a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=86=E5=BB=BA=E9=94=8B?= <467466356@qq.com> Date: Tue, 25 Oct 2022 21:07:28 +0800 Subject: [PATCH 1/2] =?UTF-8?q?2022-10-24=E7=AC=AC=E5=85=AD=E6=AC=A1?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=AF=B9=E8=B1=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...4\344\270\232\345\257\271\350\261\241.htm" | 146 ++++++++++++++++++ ...24\350\256\260\345\257\271\350\261\241.md" | 66 ++++++++ 2 files changed, 212 insertions(+) create mode 100644 "39\351\231\206\345\273\272\351\224\213/2022-10-24\347\254\254\345\205\255\346\254\241\344\275\234\344\270\232\345\257\271\350\261\241/2022-10-24\347\254\254\345\205\255\346\254\241\344\275\234\344\270\232\345\257\271\350\261\241.htm" create mode 100644 "39\351\231\206\345\273\272\351\224\213/2022-10-24\347\254\254\345\205\255\346\254\241\344\275\234\344\270\232\345\257\271\350\261\241/2022-10-24\347\254\254\345\205\255\346\254\241\347\254\224\350\256\260\345\257\271\350\261\241.md" diff --git "a/39\351\231\206\345\273\272\351\224\213/2022-10-24\347\254\254\345\205\255\346\254\241\344\275\234\344\270\232\345\257\271\350\261\241/2022-10-24\347\254\254\345\205\255\346\254\241\344\275\234\344\270\232\345\257\271\350\261\241.htm" "b/39\351\231\206\345\273\272\351\224\213/2022-10-24\347\254\254\345\205\255\346\254\241\344\275\234\344\270\232\345\257\271\350\261\241/2022-10-24\347\254\254\345\205\255\346\254\241\344\275\234\344\270\232\345\257\271\350\261\241.htm" new file mode 100644 index 0000000..6fa1491 --- /dev/null +++ "b/39\351\231\206\345\273\272\351\224\213/2022-10-24\347\254\254\345\205\255\346\254\241\344\275\234\344\270\232\345\257\271\350\261\241/2022-10-24\347\254\254\345\205\255\346\254\241\344\275\234\344\270\232\345\257\271\350\261\241.htm" @@ -0,0 +1,146 @@ + + + + + + + Document + + + + + \ No newline at end of file diff --git "a/39\351\231\206\345\273\272\351\224\213/2022-10-24\347\254\254\345\205\255\346\254\241\344\275\234\344\270\232\345\257\271\350\261\241/2022-10-24\347\254\254\345\205\255\346\254\241\347\254\224\350\256\260\345\257\271\350\261\241.md" "b/39\351\231\206\345\273\272\351\224\213/2022-10-24\347\254\254\345\205\255\346\254\241\344\275\234\344\270\232\345\257\271\350\261\241/2022-10-24\347\254\254\345\205\255\346\254\241\347\254\224\350\256\260\345\257\271\350\261\241.md" new file mode 100644 index 0000000..b4d7054 --- /dev/null +++ "b/39\351\231\206\345\273\272\351\224\213/2022-10-24\347\254\254\345\205\255\346\254\241\344\275\234\344\270\232\345\257\271\350\261\241/2022-10-24\347\254\254\345\205\255\346\254\241\347\254\224\350\256\260\345\257\271\350\261\241.md" @@ -0,0 +1,66 @@ +对象创建 + 1.字面量 + var obj = { + name:'李华', + age:18, + title:'学生', + } + 行为(方法)一般是拿来修改对象的属性值 + 2.构造函数方式 + 1. this{} :new + 2. this赋值 (自己操作) + return this + function Students(name,age){ + this.name = name; + this.age = age; + } + 3.工厂模式 (设计模式) + function GetValues(name,age) { + var that = { } + that.name = name + that.age = age + return that + } + var that = GetValues('张三',16) + console.log(typeof that); + 4.原型模式 + 5.混合模式 + + +数组解构 + const arr = [1, 4, 5, 6, 8] + let[a,b,...args] = arr + let [a, , , , b] = arr + console.log(a, b); + +对象解构 + var obj = { + name: '张三', + age: 16, + skill: { + sname: 'Java', + year: '2022' + } + } + + 取数据 + console.log(obj.skill[1].sname); + let personName = obj.name, personAge = obj.age; + 对象解构:取别名 + //使用解构:可以在一个类似对象字面量的结构中,声明多个变量。同时执行多个赋值操作 + let{name:personName, age:personAge} = obj + console.log(personName); + console.log(personAge); + //让变量直接使用属性名称 + let{name,age,job='学生'} = obj + + let name, age; + ({ name, age } = obj) + + console.log(name, age); + + 嵌套解构 + let { name: personName, skill: { sname: skillName } } = obj + console.log(personName); + console.log(skillName); + -- Gitee From 7b50b5f44a6c28198513130213d74a1dbff5a840 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=86=E5=BB=BA=E9=94=8B?= <467466356@qq.com> Date: Tue, 25 Oct 2022 15:19:14 +0000 Subject: [PATCH 2/2] =?UTF-8?q?update=2039=E9=99=86=E5=BB=BA=E9=94=8B/2022?= =?UTF-8?q?-10-24=E7=AC=AC=E5=85=AD=E6=AC=A1=E4=BD=9C=E4=B8=9A=E5=AF=B9?= =?UTF-8?q?=E8=B1=A1/2022-10-24=E7=AC=AC=E5=85=AD=E6=AC=A1=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E5=AF=B9=E8=B1=A1.htm.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 陆建锋 <467466356@qq.com> --- ...4\344\270\232\345\257\271\350\261\241.htm" | 28 ++++++++----------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git "a/39\351\231\206\345\273\272\351\224\213/2022-10-24\347\254\254\345\205\255\346\254\241\344\275\234\344\270\232\345\257\271\350\261\241/2022-10-24\347\254\254\345\205\255\346\254\241\344\275\234\344\270\232\345\257\271\350\261\241.htm" "b/39\351\231\206\345\273\272\351\224\213/2022-10-24\347\254\254\345\205\255\346\254\241\344\275\234\344\270\232\345\257\271\350\261\241/2022-10-24\347\254\254\345\205\255\346\254\241\344\275\234\344\270\232\345\257\271\350\261\241.htm" index 6fa1491..194b0b4 100644 --- "a/39\351\231\206\345\273\272\351\224\213/2022-10-24\347\254\254\345\205\255\346\254\241\344\275\234\344\270\232\345\257\271\350\261\241/2022-10-24\347\254\254\345\205\255\346\254\241\344\275\234\344\270\232\345\257\271\350\261\241.htm" +++ "b/39\351\231\206\345\273\272\351\224\213/2022-10-24\347\254\254\345\205\255\346\254\241\344\275\234\344\270\232\345\257\271\350\261\241/2022-10-24\347\254\254\345\205\255\346\254\241\344\275\234\344\270\232\345\257\271\350\261\241.htm" @@ -59,26 +59,12 @@ points: 40 } } - const nameArr = Object.keys(users) //keys:返回的是键的数组 + // console.log(nameArr); // 1.统计在线人数 - - // count = 0 - // const arr = [] - // for(let i = 0;i users[key].isLoggedIn ? count++ : count) //遍历 - console.log('在线人数' + count); @@ -130,7 +116,15 @@ // 要求: // 1).如果传入的value是一个空值,表示将该属性删除 // 2).传入的prop如果是tracks,则代表添加,其他是修改 - + function updateRecords(id,prop,value){ + value=='' ? delete collection[id][prop] :(prop=='tracks' ?collection[id][prop].push(value) :collection[id][prop]=value ) ; + } + updateRecords(3245,'tracks','有何不可') + console.log(collection); + updateRecords(3245,'tracks','') + console.log(collection); + updateRecords(5439,'album','逆光') + console.log(collection); // 3245 tracks '有何不可' -- Gitee