From 4750dd68ff74e001720e78c06b7813e06fdc5354 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E5=AF=8C=E8=B4=B5?= <2380003452@qq.com> Date: Tue, 25 Oct 2022 15:50:29 +0000 Subject: [PATCH 1/2] =?UTF-8?q?=E9=BB=84=E5=AF=8C=E8=B4=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 黄富贵 <2380003452@qq.com> --- ...\344\271\240\344\275\234\344\270\232.html" | 104 ++++++++++++++++++ ...23\346\236\204\347\254\224\350\256\260.md" | 19 ++++ 2 files changed, 123 insertions(+) create mode 100644 "36\351\273\204\345\257\214\350\264\265/10-24\344\275\234\344\270\232/10-24-\345\257\271\350\261\241\347\273\203\344\271\240\344\275\234\344\270\232.html" create mode 100644 "36\351\273\204\345\257\214\350\264\265/10-24\344\275\234\344\270\232/10-24-\345\257\271\350\261\241\347\273\223\346\236\204\347\254\224\350\256\260.md" diff --git "a/36\351\273\204\345\257\214\350\264\265/10-24\344\275\234\344\270\232/10-24-\345\257\271\350\261\241\347\273\203\344\271\240\344\275\234\344\270\232.html" "b/36\351\273\204\345\257\214\350\264\265/10-24\344\275\234\344\270\232/10-24-\345\257\271\350\261\241\347\273\203\344\271\240\344\275\234\344\270\232.html" new file mode 100644 index 0000000..2e894a1 --- /dev/null +++ "b/36\351\273\204\345\257\214\350\264\265/10-24\344\275\234\344\270\232/10-24-\345\257\271\350\261\241\347\273\203\344\271\240\344\275\234\344\270\232.html" @@ -0,0 +1,104 @@ + + + + + + + + Document + + + + + + + \ No newline at end of file diff --git "a/36\351\273\204\345\257\214\350\264\265/10-24\344\275\234\344\270\232/10-24-\345\257\271\350\261\241\347\273\223\346\236\204\347\254\224\350\256\260.md" "b/36\351\273\204\345\257\214\350\264\265/10-24\344\275\234\344\270\232/10-24-\345\257\271\350\261\241\347\273\223\346\236\204\347\254\224\350\256\260.md" new file mode 100644 index 0000000..b231f58 --- /dev/null +++ "b/36\351\273\204\345\257\214\350\264\265/10-24\344\275\234\344\270\232/10-24-\345\257\271\350\261\241\347\273\223\346\236\204\347\254\224\350\256\260.md" @@ -0,0 +1,19 @@ + + +对象解构 + +``` +    javascript +const hero = { + name:'huhu', + age:15 +} +const{name,age} = hero; +name; +ageg +``` + +// 解构赋值不一定需要与对象的属性匹配。赋值的时候可以忽略某些属性,而如果引用的属性不存在,则为undefined。此时可以在解构的同时定义默认值 + +let {name, job} = person //此时没有job属性 +let {nam, job='student'} //设定默认值 -- Gitee From a8475b3d3dcbb333983533dd754b52550cc686d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E5=AF=8C=E8=B4=B5?= <2380003452@qq.com> Date: Thu, 27 Oct 2022 04:09:38 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=E9=BB=84=E5=AF=8C=E8=B4=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 黄富贵 <2380003452@qq.com> --- ...\347\261\273\344\275\234\344\270\232.html" | 67 +++++++++++++++++++ ...05\347\261\273\347\254\224\350\256\260.md" | 47 +++++++++++++ 2 files changed, 114 insertions(+) create mode 100644 "36\351\273\204\345\257\214\350\264\265/10-26\344\275\234\344\270\232/10-26-\345\214\205\350\243\205\347\261\273\344\275\234\344\270\232.html" create mode 100644 "36\351\273\204\345\257\214\350\264\265/10-26\344\275\234\344\270\232/10-26-\345\214\205\350\243\205\347\261\273\347\254\224\350\256\260.md" diff --git "a/36\351\273\204\345\257\214\350\264\265/10-26\344\275\234\344\270\232/10-26-\345\214\205\350\243\205\347\261\273\344\275\234\344\270\232.html" "b/36\351\273\204\345\257\214\350\264\265/10-26\344\275\234\344\270\232/10-26-\345\214\205\350\243\205\347\261\273\344\275\234\344\270\232.html" new file mode 100644 index 0000000..8c14dd7 --- /dev/null +++ "b/36\351\273\204\345\257\214\350\264\265/10-26\344\275\234\344\270\232/10-26-\345\214\205\350\243\205\347\261\273\344\275\234\344\270\232.html" @@ -0,0 +1,67 @@ + + + + + + + Document + + + + + \ No newline at end of file diff --git "a/36\351\273\204\345\257\214\350\264\265/10-26\344\275\234\344\270\232/10-26-\345\214\205\350\243\205\347\261\273\347\254\224\350\256\260.md" "b/36\351\273\204\345\257\214\350\264\265/10-26\344\275\234\344\270\232/10-26-\345\214\205\350\243\205\347\261\273\347\254\224\350\256\260.md" new file mode 100644 index 0000000..7d1e8f0 --- /dev/null +++ "b/36\351\273\204\345\257\214\350\264\265/10-26\344\275\234\344\270\232/10-26-\345\214\205\350\243\205\347\261\273\347\254\224\350\256\260.md" @@ -0,0 +1,47 @@ + 包装类 + 原始数据类型: number, boolean, string, null, undefined (symbol,bigint) + var num = new Number(5) //对象 + num.a = 6 + num = num * 2 //会自动变成原始数据类型number + + var bol = new Boolean(); + bol.a = false + + var str = new String('abc'); + str.a = 'hi' + + 包装类只有:number,boolean,string, + null,undefined是没有包装类的 + + var num = 5; //原始数据类型 + num.a = 7; //1. new Number(5).a = 7 2. delete new Number(5) + console.log(num.a); //new Number(5).a undefined + + const arr = [1,3,4,5] //切片 slice + arr.length = 2 + console.log(arr); + + var str = '1345' //原始数据类型 + str.length = 2 //1.new String('1345').length = 2 2.delete String('1345') + str.aaa = 'a' //new Sting('1345').aaa = a 2.delete String('1345') + console.log(str); + console.log(str.length);//new String('1345').length = 4 + console.log(String.prototype); //String类有很多方法和length + console.log(str.aaa); //new String('1345') + + + +//for ... of :遍历 + for (e of Object.keys(obj)) { + console.log(e); + } + //将键值对成对变成数组放入外层数组(二维数组) + const arr = Object.entries(obj) + console.log(arr); + for(e of Object.entries(obj)){ + console.log(e); + } + +assign:1.浅拷贝一个对象 2.合并对象(target,sources....) + console.log(Object.assign(obj,obj1,obj2,4,false,null,[12,3,34],{name:'张三'})); + console.log(obj[0]); \ No newline at end of file -- Gitee