From 38b5741df23269cc5ef72b1f5ffadbf777cb53c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=A8=E9=A3=98?= <2422417047@qq.com> Date: Wed, 16 Nov 2022 03:25:30 +0000 Subject: [PATCH 1/3] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20READ?= =?UTF-8?q?ME.en.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.en.md | 36 ------------------------------------ 1 file changed, 36 deletions(-) delete mode 100644 README.en.md diff --git a/README.en.md b/README.en.md deleted file mode 100644 index 308ddb1..0000000 --- a/README.en.md +++ /dev/null @@ -1,36 +0,0 @@ -# 3班练习专用 - -#### Description -书山有路勤为径 - -#### Software Architecture -Software architecture description - -#### Installation - -1. xxxx -2. xxxx -3. xxxx - -#### Instructions - -1. xxxx -2. xxxx -3. xxxx - -#### Contribution - -1. Fork the repository -2. Create Feat_xxx branch -3. Commit your code -4. Create Pull Request - - -#### Gitee Feature - -1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md -2. Gitee blog [blog.gitee.com](https://blog.gitee.com) -3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore) -4. The most valuable open source project [GVP](https://gitee.com/gvp) -5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help) -6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) -- Gitee From b894830ba97a67a39e0afac3a4b381a689510881 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=A8=E9=A3=98?= <2422417047@qq.com> Date: Wed, 16 Nov 2022 03:25:39 +0000 Subject: [PATCH 2/3] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20READ?= =?UTF-8?q?ME.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 README.md diff --git a/README.md b/README.md deleted file mode 100644 index a70260e..0000000 --- a/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# 3班练习专用 - -#### 介绍 -书山有路勤为径 - -#### 软件架构 -软件架构说明 - - -#### 安装教程 - -1. xxxx -2. xxxx -3. xxxx - -#### 使用说明 - -1. xxxx -2. xxxx -3. xxxx - -#### 参与贡献 - -1. Fork 本仓库 -2. 新建 Feat_xxx 分支 -3. 提交代码 -4. 新建 Pull Request - - -#### 特技 - -1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md -2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) -3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 -4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 -5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) -6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) -- Gitee From 702c50a8d08bd04289db6c8a1d7526ce51b275d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=A8=E9=A3=98?= <2422417047@qq.com> Date: Wed, 16 Nov 2022 11:40:59 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E7=BB=83=E4=B9=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../1-6\351\242\230\347\233\256.md" | 146 ++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 "\345\221\250\351\243\230/1-6\351\242\230\347\233\256.md" diff --git "a/\345\221\250\351\243\230/1-6\351\242\230\347\233\256.md" "b/\345\221\250\351\243\230/1-6\351\242\230\347\233\256.md" new file mode 100644 index 0000000..2b9b204 --- /dev/null +++ "b/\345\221\250\351\243\230/1-6\351\242\230\347\233\256.md" @@ -0,0 +1,146 @@ +​ // 题目如下,请直接利用写好的方法,并且直接写在题目下方,要可以运行和输出,如第1题所示 + +​ /* +​ 1、题目描述: +​ 找出元素 item 在给定数组 arr 中的位置 +​ 输出描述: +​ 如果数组中存在 item,则返回元素在数组中的位置,否则返回 -1 +​ 示例1 indexOf +​ 输入 +​ [ 1, 2, 3, 4,3 ], 3 +​ 输出 +​ 2 +​ +​ function indexOf(arr, item) { +​ +​ } +​ */ +​ // console.log(`======= 第1题 =======`); +​ +​ function indexOf(arr,item) { +​ for (let i = 0; i < arr.length-1; i++) { +​ if (arr[i]==item) { +​ console.log(i); +​ } +​ } +​ } +​ indexOf([1,2,3,4,3],3); + +​ /* +​ 2、题目描述: +​ 计算给定数组 arr 中所有元素的总和 reduce() every()(some()) map() filter() forEach() +​ 输入描述: +​ 数组中的元素均为 Number 类型 +​ 示例1 +​ 输入 +​ +​ [ 1, 2, 3, 4 ] +​ 输出 +​ +​ 10 +​ +​ function sum(arr) { +​ +​ } +​ */ +​ // console.log(`======= 第2题 =======`); +​ const arr=[1,2,3,4]; +​ function sum(arr) { +​ var sum=0; +​ arr.map(function(i){ +​ sum+=i; +​ }); +​ return sum; +​ } +​ console.log(sum(arr)); + +​ /* +​ 3、题目描述 +​ 在数组 arr 末尾添加元素 item。不要直接修改数组 arr,结果返回新的数组 +​ 示例1 +​ 输入 +​ +​ [1, 2, 3, 4], 10 +​ 输出 +​ +​ [1, 2, 3, 4, 10] +​ +​ function append(arr, item) { +​ +​ } +​ */ +​ // console.log(`======= 第3题 =======`); +​ const arr=[1,2,3,4]; +​ var item=10; +​ function append(arr, item) { +​ var a=arr.slice(0); +​ a.push(item); +​ return a; +​ } +​ console.log(append(arr,item)); + +​ /* +​ 4、题目描述 +​ 合并数组 arr1 和数组 arr2。不要直接修改数组 arr,结果返回新的数组 +​ 示例1 +​ 输入 +​ +​ [1, 2, 3, 4], ['a', 'b', 'c', 1] +​ 输出 +​ +​ [1, 2, 3, 4, 'a', 'b', 'c', 1] +​ +​ function concat(arr1, arr2) { +​ +​ } +​ */ +​ // console.log(`======= 第4题 =======`); +​ const arr1=[1,2,3,4]; +​ const arr2=['a', 'b', 'c', 1] +​ function concat(arr1, arr2) { +​ var arr3=arr1.concat(arr2); +​ return arr3; +​ } +​ console.log(concat(arr1, arr2)); + +​ /* +​ 5、题目描述 +​ 为数组 arr 中的每个元素求二次方。不要直接修改数组 arr,结果返回新的数组 +​ 示例1 +​ 输入 +​ +​ [1, 2, 3, 4] +​ 输出 +​ +​ [1, 4, 9, 16] +​ +​ function square(arr) { +​ +​ } +​ */ +​ // console.log(`======= 第5题 =======`); +​ const arr=[1,2,3,4]; +​ function square(arr) { +​ const newarr=[]; +​ arr.forEach(i => { +​ newarr.push(i*i); +​ }); +​ return newarr +​ } +​ console.log(square(arr)); +​ /* +​ 6、题目描述 +​ 定义一个计算圆面积的函数area_of_circle(),它有两个参数: +​ +​ r: 表示圆的半径; +​ pi: 表示π的值,如果不传,则默认3.14 +​ +​ function area_of_circle(r, pi) { +​ +​ } +​ */ +​ // console.log(`======= 第6题 =======`); +​ function area_of_circle(r, pi=3.14) { +​ return r*r*pi; +​ } +​ console.log(area_of_circle(3,3.14)); \ No newline at end of file -- Gitee