From 4081c1b36f84c17c854e77cdf7ebdef6b9d1f8b7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=91=A8=E8=8A=B7=E8=8E=B9?= <1191106009.com>
Date: Wed, 15 Feb 2023 15:18:29 +0800
Subject: [PATCH 1/5] =?UTF-8?q?=E5=91=A8=E8=8A=B7=E8=8E=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
k.txt | 0
wym/wish.html | 12 -----
"\345\221\250\350\212\267\350\216\271/yr.js" | 7 +++
"\345\221\250\350\212\267\350\216\271/zzy.js" | 44 +++++++++++++++++++
.../\346\250\241\345\235\227/index.html" | 14 ------
.../\346\250\241\345\235\227/jsq.js" | 8 ----
.../\346\250\241\345\235\227/shuzhi.js" | 3 --
7 files changed, 51 insertions(+), 37 deletions(-)
delete mode 100644 k.txt
delete mode 100644 wym/wish.html
create mode 100644 "\345\221\250\350\212\267\350\216\271/yr.js"
create mode 100644 "\345\221\250\350\212\267\350\216\271/zzy.js"
delete mode 100644 "\347\216\213\351\200\270\346\260\221/\346\250\241\345\235\227/index.html"
delete mode 100644 "\347\216\213\351\200\270\346\260\221/\346\250\241\345\235\227/jsq.js"
delete mode 100644 "\347\216\213\351\200\270\346\260\221/\346\250\241\345\235\227/shuzhi.js"
diff --git a/k.txt b/k.txt
deleted file mode 100644
index e69de29..0000000
diff --git a/wym/wish.html b/wym/wish.html
deleted file mode 100644
index 8fd0b0f..0000000
--- a/wym/wish.html
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
- 要工作了
-
-
- 好好学习,努力挣钱,养自己/养女朋友/养男朋友
-
-
\ No newline at end of file
diff --git "a/\345\221\250\350\212\267\350\216\271/yr.js" "b/\345\221\250\350\212\267\350\216\271/yr.js"
new file mode 100644
index 0000000..d940bed
--- /dev/null
+++ "b/\345\221\250\350\212\267\350\216\271/yr.js"
@@ -0,0 +1,7 @@
+// 传入文件
+var obj = require('./zzy.js')
+console.log(obj.add(1,2))
+console.log(obj.jian(200,100))
+console.log(obj.cheng(2,100))
+console.log(obj.chu(200,100))
+
diff --git "a/\345\221\250\350\212\267\350\216\271/zzy.js" "b/\345\221\250\350\212\267\350\216\271/zzy.js"
new file mode 100644
index 0000000..378db0c
--- /dev/null
+++ "b/\345\221\250\350\212\267\350\216\271/zzy.js"
@@ -0,0 +1,44 @@
+// 作业:写个加减乘除的模块(尽量少写暴露,要考虑复用性),供外部使用. 作业每个分支要建一个目录(自己名字)
+var num;
+let obj = {
+ add:function(a,b){
+ if(Number(a) && Number(b)){
+ num=a+b;
+ return num;
+ }else{
+ console.log("输入的值必须为数字")
+ }
+
+ },
+ jian:function(a,b){
+ if(Number(a) && Number(b)){
+ num=a-b;
+ return num;
+ }else{
+ console.log("输入的值必须为数字")
+ }
+ },
+ cheng:function(a,b){
+ if(Number(a) && Number(b)){
+ num=a*b;
+ return num;
+ }else{
+ console.log("输入的值必须为数字")
+ }
+ },
+ chu:function(a,b){
+ if(Number(a) && Number(b) && a!=0){
+ num=a/b;
+ return num;
+ }else{
+ console.log("输入的值必须为数字且除数不能为0")
+ }
+ }
+}
+// 暴露
+module.exports =obj;
+
+
+
+
+
diff --git "a/\347\216\213\351\200\270\346\260\221/\346\250\241\345\235\227/index.html" "b/\347\216\213\351\200\270\346\260\221/\346\250\241\345\235\227/index.html"
deleted file mode 100644
index b2ec421..0000000
--- "a/\347\216\213\351\200\270\346\260\221/\346\250\241\345\235\227/index.html"
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
- Document
-
-
-
-
-
-
-
\ No newline at end of file
diff --git "a/\347\216\213\351\200\270\346\260\221/\346\250\241\345\235\227/jsq.js" "b/\347\216\213\351\200\270\346\260\221/\346\250\241\345\235\227/jsq.js"
deleted file mode 100644
index 9304e33..0000000
--- "a/\347\216\213\351\200\270\346\260\221/\346\250\241\345\235\227/jsq.js"
+++ /dev/null
@@ -1,8 +0,0 @@
-let obj={
- jia :function jia(shu1,shu2){
- return shu1+shu2;
- }
-}
-
-
-module.exports = obj;
\ No newline at end of file
diff --git "a/\347\216\213\351\200\270\346\260\221/\346\250\241\345\235\227/shuzhi.js" "b/\347\216\213\351\200\270\346\260\221/\346\250\241\345\235\227/shuzhi.js"
deleted file mode 100644
index b45016a..0000000
--- "a/\347\216\213\351\200\270\346\260\221/\346\250\241\345\235\227/shuzhi.js"
+++ /dev/null
@@ -1,3 +0,0 @@
-let obj= require("./jsq.js");
-
-console.log(obj.jia(10,20));
\ No newline at end of file
--
Gitee
From fdd3fd077e1bb4484028e9983689b11d2e9fd41b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=91=A8=E8=8A=B7=E8=8E=B9?= <1191106009.com>
Date: Wed, 15 Feb 2023 19:30:42 +0800
Subject: [PATCH 2/5] =?UTF-8?q?=E5=91=A8=E8=8A=B7=E8=8E=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../yr.js" => "\345\221\250\350\212\267\350\216\271/zzy/yr.js" | 0
.../zzy.js" => "\345\221\250\350\212\267\350\216\271/zzy/zzy.js" | 0
2 files changed, 0 insertions(+), 0 deletions(-)
rename "\345\221\250\350\212\267\350\216\271/yr.js" => "\345\221\250\350\212\267\350\216\271/zzy/yr.js" (100%)
rename "\345\221\250\350\212\267\350\216\271/zzy.js" => "\345\221\250\350\212\267\350\216\271/zzy/zzy.js" (100%)
diff --git "a/\345\221\250\350\212\267\350\216\271/yr.js" "b/\345\221\250\350\212\267\350\216\271/zzy/yr.js"
similarity index 100%
rename from "\345\221\250\350\212\267\350\216\271/yr.js"
rename to "\345\221\250\350\212\267\350\216\271/zzy/yr.js"
diff --git "a/\345\221\250\350\212\267\350\216\271/zzy.js" "b/\345\221\250\350\212\267\350\216\271/zzy/zzy.js"
similarity index 100%
rename from "\345\221\250\350\212\267\350\216\271/zzy.js"
rename to "\345\221\250\350\212\267\350\216\271/zzy/zzy.js"
--
Gitee
From 67805c4ea6300427852b05c8fe79f00789158446 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=91=A8=E8=8A=B7=E8=8E=B9?= <1191106009@qq.com>
Date: Thu, 16 Feb 2023 17:01:51 +0800
Subject: [PATCH 3/5] =?UTF-8?q?=E5=91=A8=E8=8A=B7=E8=8E=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../2.15-\346\250\241\345\235\227/yr.js" | 0
.../2.15-\346\250\241\345\235\227/zzy.js" | 0
.../sjs.js" | 42 +++++++++++++++++++
3 files changed, 42 insertions(+)
rename "\345\221\250\350\212\267\350\216\271/zzy/yr.js" => "\345\221\250\350\212\267\350\216\271/2.15-\346\250\241\345\235\227/yr.js" (100%)
rename "\345\221\250\350\212\267\350\216\271/zzy/zzy.js" => "\345\221\250\350\212\267\350\216\271/2.15-\346\250\241\345\235\227/zzy.js" (100%)
create mode 100644 "\345\221\250\350\212\267\350\216\271/2.16-\346\226\207\344\273\266\347\232\204\345\210\233\345\273\272\344\270\216\350\257\273\345\217\226/sjs.js"
diff --git "a/\345\221\250\350\212\267\350\216\271/zzy/yr.js" "b/\345\221\250\350\212\267\350\216\271/2.15-\346\250\241\345\235\227/yr.js"
similarity index 100%
rename from "\345\221\250\350\212\267\350\216\271/zzy/yr.js"
rename to "\345\221\250\350\212\267\350\216\271/2.15-\346\250\241\345\235\227/yr.js"
diff --git "a/\345\221\250\350\212\267\350\216\271/zzy/zzy.js" "b/\345\221\250\350\212\267\350\216\271/2.15-\346\250\241\345\235\227/zzy.js"
similarity index 100%
rename from "\345\221\250\350\212\267\350\216\271/zzy/zzy.js"
rename to "\345\221\250\350\212\267\350\216\271/2.15-\346\250\241\345\235\227/zzy.js"
diff --git "a/\345\221\250\350\212\267\350\216\271/2.16-\346\226\207\344\273\266\347\232\204\345\210\233\345\273\272\344\270\216\350\257\273\345\217\226/sjs.js" "b/\345\221\250\350\212\267\350\216\271/2.16-\346\226\207\344\273\266\347\232\204\345\210\233\345\273\272\344\270\216\350\257\273\345\217\226/sjs.js"
new file mode 100644
index 0000000..7104d7e
--- /dev/null
+++ "b/\345\221\250\350\212\267\350\216\271/2.16-\346\226\207\344\273\266\347\232\204\345\210\233\345\273\272\344\270\216\350\257\273\345\217\226/sjs.js"
@@ -0,0 +1,42 @@
+// 作业:生成100个文件,每个文件存入一个1到1000的随机数字,再取出最大值的那个文件,值也要取出来,再取出最小的那个.
+
+// 引入fs,只有引入这个node自带的js才能使用下面的文件创建(writeFileSync)与读取(readFileSync)
+let fs= require("fs");
+let sz=[];
+let max=0;
+let min=1001;
+// 最大值文件名
+let maxtxtname=0;
+// 最小值文件名
+let mintxtname=0;
+
+
+for(i=1;i<101;i++){
+ // 创建随机数
+ let random = Math.ceil(Math.random()*1000);
+
+ // 创建100个文件并赋值随机数
+ fs.writeFileSync("./"+i+".txt",""+random+"");
+
+ // 读取100个文件内的随机数并存入数组中,要用toString()进行转换
+ sz[i]=(fs.readFileSync("./"+i+".txt").toString());
+
+ // max
+ if(Number(sz[i])>max){
+ max = Number(sz[i]);
+ maxtxtname=i;
+ }
+
+ // min
+ if(Number(sz[i])
Date: Sat, 18 Feb 2023 13:05:01 +0800
Subject: [PATCH 4/5] =?UTF-8?q?=E5=91=A8=E8=8A=B7=E8=8E=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../2.18-\350\200\227\346\227\266/time.js" | 32 +++++++++++++++++++
1 file changed, 32 insertions(+)
create mode 100644 "\345\221\250\350\212\267\350\216\271/2.18-\350\200\227\346\227\266/time.js"
diff --git "a/\345\221\250\350\212\267\350\216\271/2.18-\350\200\227\346\227\266/time.js" "b/\345\221\250\350\212\267\350\216\271/2.18-\350\200\227\346\227\266/time.js"
new file mode 100644
index 0000000..6c27214
--- /dev/null
+++ "b/\345\221\250\350\212\267\350\216\271/2.18-\350\200\227\346\227\266/time.js"
@@ -0,0 +1,32 @@
+// 引入自带的fs.js文件
+let fs = require("fs")
+
+// 获取循环前的时间
+var t1 = new Date().getTime();
+// 同步
+for(i=1;i<=10000;i++){
+ fs.writeFileSync(""+i+".txt","aaa");
+}
+
+// 获取循环结束后的时间
+var t2 = new Date().getTime();
+console.log("同步共花费时间:"+(t2-t1)+"毫秒");
+
+
+// 获取循环前的时间
+var t3 = new Date().getTime();
+// 同步
+for(i=1;i<=10000;i++){
+ fs.writeFile(""+i+".txt","aaa",function(err){});
+}
+
+// 获取循环结束后的时间
+var t4 = new Date().getTime();
+console.log("异步共花费时间:"+(t4-t3)+"毫秒");
+
+
+
+
+
+
+
--
Gitee
From cde94aae236530c47bcd32ae77e70d9c72f8033b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=91=A8=E8=8A=B7=E8=8E=B9?= <1191106009.com>
Date: Tue, 21 Feb 2023 16:15:18 +0800
Subject: [PATCH 5/5] =?UTF-8?q?=E5=91=A8=E8=8A=B7=E8=8E=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../2.18-\350\200\227\346\227\266/time.js" | 32 --------
.../2.20-\346\265\201/liu.js" | 73 +++++++++++++++++++
2 files changed, 73 insertions(+), 32 deletions(-)
delete mode 100644 "\345\221\250\350\212\267\350\216\271/2.18-\350\200\227\346\227\266/time.js"
create mode 100644 "\345\221\250\350\212\267\350\216\271/2.20-\346\265\201/liu.js"
diff --git "a/\345\221\250\350\212\267\350\216\271/2.18-\350\200\227\346\227\266/time.js" "b/\345\221\250\350\212\267\350\216\271/2.18-\350\200\227\346\227\266/time.js"
deleted file mode 100644
index 6c27214..0000000
--- "a/\345\221\250\350\212\267\350\216\271/2.18-\350\200\227\346\227\266/time.js"
+++ /dev/null
@@ -1,32 +0,0 @@
-// 引入自带的fs.js文件
-let fs = require("fs")
-
-// 获取循环前的时间
-var t1 = new Date().getTime();
-// 同步
-for(i=1;i<=10000;i++){
- fs.writeFileSync(""+i+".txt","aaa");
-}
-
-// 获取循环结束后的时间
-var t2 = new Date().getTime();
-console.log("同步共花费时间:"+(t2-t1)+"毫秒");
-
-
-// 获取循环前的时间
-var t3 = new Date().getTime();
-// 同步
-for(i=1;i<=10000;i++){
- fs.writeFile(""+i+".txt","aaa",function(err){});
-}
-
-// 获取循环结束后的时间
-var t4 = new Date().getTime();
-console.log("异步共花费时间:"+(t4-t3)+"毫秒");
-
-
-
-
-
-
-
diff --git "a/\345\221\250\350\212\267\350\216\271/2.20-\346\265\201/liu.js" "b/\345\221\250\350\212\267\350\216\271/2.20-\346\265\201/liu.js"
new file mode 100644
index 0000000..2f6f973
--- /dev/null
+++ "b/\345\221\250\350\212\267\350\216\271/2.20-\346\265\201/liu.js"
@@ -0,0 +1,73 @@
+// 作业1:使用open write close的形式去创建一个大文件,内容从指定的文本中随机取一些(每次取得长度内容可以不一样),计算出这个大文件出现最多的字符(要使用流的形式).
+
+// 引入fs.js文件
+let fs = require("fs");
+
+
+// 使用open write close的形式去创建一个大文件,打开——写入——关闭
+// w 表示覆盖(之前的文件已有内容,会用新内容覆盖掉旧内容),a 表示追加内容且不覆盖
+let wj=fs.openSync("./wenjian.txt",'w');
+
+// 写入内容
+// 随机定义字符串
+let str = "zhouzhiying";
+
+for(i=0;i<100;i++){
+ // 循环获取随机字符串的长度
+ let len= Math.ceil(Math.random()*20);
+
+ // 定义一个空变量来接收每一个字,并组成一个字符串
+ let kon=" ";
+
+ // 随机取不同长度的文本,每次都不一样
+ for(j=0;j{
+ console.log(sj);
+ let nr= sj;
+ for(let k=0;kmax){
+ max=sz[key];
+ zhi=key;
+ }
+ }
+ console.log(sz);
+ console.log("出现最多的字符是:"+zhi+",共出现了"+max+"次");
+});
+// 结束事件监听
+duqu.on("end",()=>{
+ console.log("---------------------------读取完毕--------------------------");
+})
+
+
+
+
+
+
+
--
Gitee