diff --git "a/\345\275\255\346\260\270\347\233\233/20241105 \345\207\275\346\225\260/.idea/.gitignore" "b/\345\275\255\346\260\270\347\233\233/20241105 \345\207\275\346\225\260/.idea/.gitignore" new file mode 100644 index 0000000000000000000000000000000000000000..35410cacdc5e87f985c93a96520f5e11a5c822e4 --- /dev/null +++ "b/\345\275\255\346\260\270\347\233\233/20241105 \345\207\275\346\225\260/.idea/.gitignore" @@ -0,0 +1,8 @@ +# 默认忽略的文件 +/shelf/ +/workspace.xml +# 基于编辑器的 HTTP 客户端请求 +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git "a/\345\275\255\346\260\270\347\233\233/20241105 \345\207\275\346\225\260/.idea/20241105.iml" "b/\345\275\255\346\260\270\347\233\233/20241105 \345\207\275\346\225\260/.idea/20241105.iml" new file mode 100644 index 0000000000000000000000000000000000000000..b30f405e7c58dc170f3f8341a933924cc1e5ab86 --- /dev/null +++ "b/\345\275\255\346\260\270\347\233\233/20241105 \345\207\275\346\225\260/.idea/20241105.iml" @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git "a/\345\275\255\346\260\270\347\233\233/20241105 \345\207\275\346\225\260/.idea/misc.xml" "b/\345\275\255\346\260\270\347\233\233/20241105 \345\207\275\346\225\260/.idea/misc.xml" new file mode 100644 index 0000000000000000000000000000000000000000..b0af9cdcefb613a217f7eff4d214c61895c0f9cd --- /dev/null +++ "b/\345\275\255\346\260\270\347\233\233/20241105 \345\207\275\346\225\260/.idea/misc.xml" @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git "a/\345\275\255\346\260\270\347\233\233/20241105 \345\207\275\346\225\260/.idea/modules.xml" "b/\345\275\255\346\260\270\347\233\233/20241105 \345\207\275\346\225\260/.idea/modules.xml" new file mode 100644 index 0000000000000000000000000000000000000000..159b1edb511e49f591047cc61cdf0f8f4bec0e74 --- /dev/null +++ "b/\345\275\255\346\260\270\347\233\233/20241105 \345\207\275\346\225\260/.idea/modules.xml" @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git "a/\345\275\255\346\260\270\347\233\233/20241105 \345\207\275\346\225\260/.idea/vcs.xml" "b/\345\275\255\346\260\270\347\233\233/20241105 \345\207\275\346\225\260/.idea/vcs.xml" new file mode 100644 index 0000000000000000000000000000000000000000..b2bdec2d71b6a5ce4ae49efc37516809c50e4d5e --- /dev/null +++ "b/\345\275\255\346\260\270\347\233\233/20241105 \345\207\275\346\225\260/.idea/vcs.xml" @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git "a/\345\275\255\346\260\270\347\233\233/20241105 \345\207\275\346\225\260/assets/1647946669524.png" "b/\345\275\255\346\260\270\347\233\233/20241105 \345\207\275\346\225\260/assets/1647946669524.png" new file mode 100644 index 0000000000000000000000000000000000000000..94a646039ab649990f42580e59bc90649bbb19f3 Binary files /dev/null and "b/\345\275\255\346\260\270\347\233\233/20241105 \345\207\275\346\225\260/assets/1647946669524.png" differ diff --git "a/\345\275\255\346\260\270\347\233\233/20241105 \345\207\275\346\225\260/html/01.html" "b/\345\275\255\346\260\270\347\233\233/20241105 \345\207\275\346\225\260/html/01.html" new file mode 100644 index 0000000000000000000000000000000000000000..c964208376b5c6d831550ea111f53f5ce3c68931 --- /dev/null +++ "b/\345\275\255\346\260\270\347\233\233/20241105 \345\207\275\346\225\260/html/01.html" @@ -0,0 +1,22 @@ + + + + + Title + + + + + \ No newline at end of file diff --git "a/\345\275\255\346\260\270\347\233\233/20241105 \345\207\275\346\225\260/html/02.html" "b/\345\275\255\346\260\270\347\233\233/20241105 \345\207\275\346\225\260/html/02.html" new file mode 100644 index 0000000000000000000000000000000000000000..08fa7c75f37499a5fbc197f6837fcdc94764dc0f --- /dev/null +++ "b/\345\275\255\346\260\270\347\233\233/20241105 \345\207\275\346\225\260/html/02.html" @@ -0,0 +1,30 @@ + + + + + Title + + + + + \ No newline at end of file diff --git "a/\345\275\255\346\260\270\347\233\233/20241105 \345\207\275\346\225\260/html/03.html" "b/\345\275\255\346\260\270\347\233\233/20241105 \345\207\275\346\225\260/html/03.html" new file mode 100644 index 0000000000000000000000000000000000000000..bbd2713dda7e261b00c10fdeb35f4bb85eda45e8 --- /dev/null +++ "b/\345\275\255\346\260\270\347\233\233/20241105 \345\207\275\346\225\260/html/03.html" @@ -0,0 +1,32 @@ + + + + + Title + + + + + \ No newline at end of file diff --git "a/\345\275\255\346\260\270\347\233\233/20241105 \345\207\275\346\225\260/html/04.html" "b/\345\275\255\346\260\270\347\233\233/20241105 \345\207\275\346\225\260/html/04.html" new file mode 100644 index 0000000000000000000000000000000000000000..6a191d131e90ddd26624429a2c52d23eaf284f7f --- /dev/null +++ "b/\345\275\255\346\260\270\347\233\233/20241105 \345\207\275\346\225\260/html/04.html" @@ -0,0 +1,35 @@ + + + + + Title + + + + + \ No newline at end of file diff --git "a/\345\275\255\346\260\270\347\233\233/20241105 \345\207\275\346\225\260/html/05.html" "b/\345\275\255\346\260\270\347\233\233/20241105 \345\207\275\346\225\260/html/05.html" new file mode 100644 index 0000000000000000000000000000000000000000..f6cf86d5502281bc64c1374a185f19c240cf2146 --- /dev/null +++ "b/\345\275\255\346\260\270\347\233\233/20241105 \345\207\275\346\225\260/html/05.html" @@ -0,0 +1,34 @@ + + + + + Title + + + + + + + + + diff --git "a/\345\275\255\346\260\270\347\233\233/20241105 \345\207\275\346\225\260/html/06.html" "b/\345\275\255\346\260\270\347\233\233/20241105 \345\207\275\346\225\260/html/06.html" new file mode 100644 index 0000000000000000000000000000000000000000..8309e5c61f465839f269af02f31a9b34417ee44d --- /dev/null +++ "b/\345\275\255\346\260\270\347\233\233/20241105 \345\207\275\346\225\260/html/06.html" @@ -0,0 +1,36 @@ + + + + + Title + + + + + \ No newline at end of file diff --git "a/\345\275\255\346\260\270\347\233\233/20241105 \345\207\275\346\225\260/\344\275\234\344\270\232.md" "b/\345\275\255\346\260\270\347\233\233/20241105 \345\207\275\346\225\260/\344\275\234\344\270\232.md" new file mode 100644 index 0000000000000000000000000000000000000000..44c1e46c102bdb5f2cf74a604f78e7520b63cf9f --- /dev/null +++ "b/\345\275\255\346\260\270\347\233\233/20241105 \345\207\275\346\225\260/\344\275\234\344\270\232.md" @@ -0,0 +1,154 @@ +# JavaScript基础第四天作业 + +## 主观题 + +### 练习题1: + +请看以下代码,并说出执行的流程~~~ + +```javascript +function printfInput(content) { + // 将用户输入的内容, 在页面中显示 + document.write(content) +} +let constr = prompt('请输入内容') +printfInput(constr) +// 先定义一个函数,在再定义一个形参content在页面中展示出来,然后定义一个变量constr来存放用户输入的内容,然后使用printfinput函数打印用户输入的内容 +``` + +### 练习题2: + +**目标:**求和函数封装练习 + +**要求:** + +1. 封装函数, 名字为sum +2. 功能: 根据传入的两个数,求和并且返回求和的结果(函数必须有return返回值) + +### 练习题3: + +**目的:** 封装函数, 复习函数的基本写法。 + +**需求:**实现两个数的值交换(函数版本) + +**分析:** + +1. 函数名为 changeNum() +2. 调用函数时, `changeNum(1,2)` +3. 经过函数内部处理后,输出 `第一个值的结果是2 第二个值的结果是1` +4. 可以多调用两次 + +### 练习题4: + +**目的:** 复习函数的声明与调用 + +**题目:**封装余额函数 + +**要求:** + +1. 运行程序后, 浏览器显示输入确认框(prompt) +2. 第一个输入确认框提示输入银行卡余额 +3. 第二个输入确认框提示输入当月食宿消费金额 +4. 第三个输入确认框提示输入当月生活消费金额 +5. 输入完毕后,在页面中显示银行卡剩余金额 +6. 提示: 所有功能代码封装在函数内部(函数需要把余额返回) + +### 练习题5: + +**目标:** 封装一个函数,可以求任意数组的和 或 平均值 + +**要求:** + +- 函数可以传递2个参数,比如 handleData(arr, true) `handleData 处理数据的意思` + * 参数一: 接受实参传递过来的数组 + * 参数二: 布尔类型 如果是true或者不传递参数 是求和操作, 如果传递过来的参数是 false 则是求平均值 + +### 拓展题1 + +需求: 封装 some 函数查看数组是否存在某个元素 。 + +- 要传递2个参数 元素、数组 +- 如果数组存在元素则返回true,如果没有存在元素就返回 false + +例如检测 香蕉 是否存在于 数组['苹果', '香蕉', '橘子', '荔枝', '梨子']中, 返回结果是 true + +格式如下: + +~~~javascript + function some(ele, arr = []) { + // 里面写业务逻辑 + } +let re = some('荔枝', ['苹果', '香蕉', '橘子', '荔枝', '梨子']) +console.log(re) // true +let re1 = some('榴莲', ['苹果', '香蕉', '橘子', '荔枝', '梨子']) +console.log(re1) // false +~~~ + +### 拓展题2 + +需求: 封装 findeIndex 函数返回查找元素在数组中的索引号。 + +- 要传递2个参数 元素、数组 +- 如果找到,则返回查找元素在数组中的索引号,如果查找不到,则返回 -1 + +例如检测 香蕉 数组['苹果', '香蕉', '橘子', '荔枝', '梨子']中, 返回结果是 1 + +格式如下: + +~~~html + +~~~ + +## 排错题 + +### 排错题1 + +~~~html + + + + +~~~ + +### 排错题2 + +~~~html + + + + +~~~ + + + + +