From c5e457bf4313dd64a0024a7a648266b5a38c2519 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BA=84=E4=BA=91?= <1487274726@qq.com> Date: Tue, 25 Oct 2022 22:14:19 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E7=AC=AC=E5=85=AD=E6=AC=A1=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../2022-10-24\345\257\271\350\261\241.html" | 57 ++++++++++++++++++ .../\347\254\224\350\256\260/JavaScript.md" | 58 ++++++++++++++----- 2 files changed, 101 insertions(+), 14 deletions(-) create mode 100644 "21\345\272\204\344\272\221/\344\275\234\344\270\232/2022-10-24\345\257\271\350\261\241.html" diff --git "a/21\345\272\204\344\272\221/\344\275\234\344\270\232/2022-10-24\345\257\271\350\261\241.html" "b/21\345\272\204\344\272\221/\344\275\234\344\270\232/2022-10-24\345\257\271\350\261\241.html" new file mode 100644 index 0000000..6b57ca4 --- /dev/null +++ "b/21\345\272\204\344\272\221/\344\275\234\344\270\232/2022-10-24\345\257\271\350\261\241.html" @@ -0,0 +1,57 @@ + + + + + + + Document + + + + + \ No newline at end of file diff --git "a/21\345\272\204\344\272\221/\347\254\224\350\256\260/JavaScript.md" "b/21\345\272\204\344\272\221/\347\254\224\350\256\260/JavaScript.md" index 40fba21..c2e2920 100644 --- "a/21\345\272\204\344\272\221/\347\254\224\350\256\260/JavaScript.md" +++ "b/21\345\272\204\344\272\221/\347\254\224\350\256\260/JavaScript.md" @@ -286,7 +286,7 @@ splice(index,delecount,insertvalue) reverse() ``` -#### 数组解构 +#### 数组解构 ```javascript const arr = [1,2,3,4]; @@ -335,7 +335,7 @@ var[a,...args] = arr; } ) //every():只要有一个不满足条件就返回false -// some():只要有一个不满足条件就返回true +// some():只要有一个满足条件就返回true var isMatch = arr.every( function (e){ return e>1 @@ -376,16 +376,35 @@ var aa=(参数)=>{ ## 七、对象 -#### 字面量表达式创建对象 +#### 创建对象 ```javascript -var obj = { - //属性 - name:'' - age: - //行为 - -} +var obj = new GetName() +//字面量 + var obj { + name='' + age: + make:function(){ + + } + } +//构造函数方式 + function obj(name,age){ + this,name=name; + this.age=age; + } +var Obj=new obj(name,age) +//工厂模式 + function GetValues(name,age) { + var that = { } + that.name = name + that.age = age + return that + } + var that = GetValues('张三',16) + console.log(typeof that); +//原型模式 +//混合模式 ``` #### 增 @@ -404,15 +423,26 @@ var obj = { // console.log(obj); ``` - - #### 改 #### 查 -#### 创建对象 +#### 对象解构 ```javascript -var obj = new GetName() + var obj = { + name: '张三', + age: 16, + skill: { + sname: 'Java', + year: '2022' + } + } + //取数据 + let{name:personName, age:personAge} = obj + //嵌套解构 + let { name: personName, skill: { sname: skillName } } = obj ``` + + -- Gitee From 920fa61096be04dd1c182355b0780f9c4db364e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BA=84=E4=BA=91?= <1487274726@qq.com> Date: Wed, 26 Oct 2022 23:07:27 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E7=AC=AC=E5=85=AD=E6=AC=A1=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../2022-10-26\345\214\205\350\243\205.html" | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 "21\345\272\204\344\272\221/\344\275\234\344\270\232/2022-10-26\345\214\205\350\243\205.html" diff --git "a/21\345\272\204\344\272\221/\344\275\234\344\270\232/2022-10-26\345\214\205\350\243\205.html" "b/21\345\272\204\344\272\221/\344\275\234\344\270\232/2022-10-26\345\214\205\350\243\205.html" new file mode 100644 index 0000000..82d923d --- /dev/null +++ "b/21\345\272\204\344\272\221/\344\275\234\344\270\232/2022-10-26\345\214\205\350\243\205.html" @@ -0,0 +1,87 @@ + + + + + + + Document + + + + + \ No newline at end of file -- Gitee