diff --git "a/02.15-\346\250\241\345\235\227/use.js" "b/02.15-\346\250\241\345\235\227/use.js" deleted file mode 100644 index 3e06d4e8d978815193375bf9436e228e47cb4a9f..0000000000000000000000000000000000000000 --- "a/02.15-\346\250\241\345\235\227/use.js" +++ /dev/null @@ -1,2 +0,0 @@ -var module1 = require('./moduleObj'); -console.log(module1.add()); \ No newline at end of file diff --git a/README.en.md b/README.en.md deleted file mode 100644 index 5cd88052014bc152e84f073336c49cab99b9e0ef..0000000000000000000000000000000000000000 --- a/README.en.md +++ /dev/null @@ -1,36 +0,0 @@ -# 21届7班node作业 - -#### Description -{**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**} - -#### 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/) diff --git a/README.md b/README.md deleted file mode 100644 index 2354532e654753c37b3e14c7c8547a4b525c26f3..0000000000000000000000000000000000000000 --- a/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# 21届7班node作业 - -#### 介绍 -{**以下是 Gitee 平台说明,您可以替换此简介** -Gitee 是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN)。专为开发者提供稳定、高效、安全的云端软件开发协作平台 -无论是个人、团队、或是企业,都能够用 Gitee 实现代码托管、项目管理、协作开发。企业项目请看 [https://gitee.com/enterprises](https://gitee.com/enterprises)} - -#### 软件架构 -软件架构说明 - - -#### 安装教程 - -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/) diff --git a/wish.html b/wish.html deleted file mode 100644 index 8fd0b0fba13d395e8454cf76de57aa742c90f5f6..0000000000000000000000000000000000000000 --- a/wish.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - 要工作了 - - -

好好学习,努力挣钱,养自己/养女朋友/养男朋友

- - \ No newline at end of file diff --git "a/\346\210\264\344\275\263\350\276\211/20230215-\346\250\241\345\235\227\347\232\204\344\275\277\347\224\250/module.js" "b/\346\210\264\344\275\263\350\276\211/20230215-\346\250\241\345\235\227\347\232\204\344\275\277\347\224\250/module.js" new file mode 100644 index 0000000000000000000000000000000000000000..bfe359d93123b8af84fbc19702deaaa593608723 --- /dev/null +++ "b/\346\210\264\344\275\263\350\276\211/20230215-\346\250\241\345\235\227\347\232\204\344\275\277\347\224\250/module.js" @@ -0,0 +1,23 @@ +//作业:写个加减乘除的模块(尽量少写暴露,要考虑复用性),供外部使用. 作业每个分支要建一个目录(自己名字) +class method { + constructor(a,b){ + this.a = a; + this.b = b; + } + add(){ + return this.a + this.b; + } + subtract(){ + return this.a - this.b; + } + multiply(){ + return this.a * this.b; + } + divide(){ + if(this.b==0){ + return "除数不能为零"; + } + return this.a / this.b; + } +} +module.exports = method; \ No newline at end of file diff --git "a/02.15-\346\250\241\345\235\227/moduleObj.js" "b/\346\210\264\344\275\263\350\276\211/20230215-\346\250\241\345\235\227\347\232\204\344\275\277\347\224\250/\344\275\234\344\270\232.js" similarity index 30% rename from "02.15-\346\250\241\345\235\227/moduleObj.js" rename to "\346\210\264\344\275\263\350\276\211/20230215-\346\250\241\345\235\227\347\232\204\344\275\277\347\224\250/\344\275\234\344\270\232.js" index e0cdbedf925ef1178f9bf6f963349e3100f00011..43611eb9c172a940c2a29fb90af4d5086d76cf93 100644 --- "a/02.15-\346\250\241\345\235\227/moduleObj.js" +++ "b/\346\210\264\344\275\263\350\276\211/20230215-\346\250\241\345\235\227\347\232\204\344\275\277\347\224\250/\344\275\234\344\270\232.js" @@ -1,22 +1,9 @@ -//作业:写个加减乘除的模块(尽量少写暴露,要考虑复用性),供外部使用. 作业每个分支要建一个目录(自己名字) -//加法 - - var x = 6; - var y = 3; - let obj={ - "add":function () { - return x+y; - }, - "jian":function () { - return x-y; - }, - "cheng":function () { - return x*y; - }, - "chu":function () { - return x/y; - } - }; - - -module.exports = obj; \ No newline at end of file +//作业:写个加减乘除的模块(尽量少写暴露,要考虑复用性),供外部使用. 作业每个分支要建一个目录(自己名字) +let obj = require("./module"); + +var add = new obj(10,5); + +console.log('加法结果为:'+add.add()); +console.log('减法结果为:'+add.subtract()); +console.log('乘法结果为:'+add.multiply()); +console.log('除法结果为:'+add.divide()); \ No newline at end of file diff --git "a/\346\210\264\344\275\263\350\276\211/20230216-\346\226\207\344\273\266\347\232\204\345\206\231\345\205\245\344\273\245\345\217\212\350\257\273\345\217\226/file.js" "b/\346\210\264\344\275\263\350\276\211/20230216-\346\226\207\344\273\266\347\232\204\345\206\231\345\205\245\344\273\245\345\217\212\350\257\273\345\217\226/file.js" new file mode 100644 index 0000000000000000000000000000000000000000..8c93aaf5493525f618af297f8c24b0f923258494 --- /dev/null +++ "b/\346\210\264\344\275\263\350\276\211/20230216-\346\226\207\344\273\266\347\232\204\345\206\231\345\205\245\344\273\245\345\217\212\350\257\273\345\217\226/file.js" @@ -0,0 +1,52 @@ +//文件读取需要使用fs模块,fs node自带的 +let fs = require("fs"); +//异步读取文件 +// fs.readFile('./weekend.txt', (error, data) => { +// console.log(error); +// console.log(data);//data 是 Buffer 类型 +// console.log(data.toString());//1 +// }); +// console.log("我在前面还是后面输出");// + +//同步读取文件 +// let data = fs.readFileSync("./sports.txt"); +// console.log(data.toString()); +// console.log("会不会先输出"); + +//假设读取文件 100毫秒,一个函数执行5毫秒,异步方式执行这个代码,总的耗时是多少 100毫秒,同步方式 105毫秒 + +//文件写入 + +//同步文件写入,有这个Sync就是同步 + +// 作业:生成100个文件,每个文件存入一个1到1000的随机数字,再取出最大值的那个文件,值也要取出来,再取出最小的那个. +var arr=[]; +for(let i=1;i<=10;i++){ + var a = Math.floor(Math.random()*1001); + fs.writeFileSync("./D"+i,""+a); + arr.push(a); + fs.readFile("./D"+i,(error,data)=>{ + var num = data.toString(); + console.log("该文件夹后缀为:"+i+",数值为:"+num); + }) +} +var max=arr[0]; +var maxhz=1; +for(let ii=0;iimax){ + max=arr[ii]; + maxhz=ii+1; + } +} + +var min=arr[0]; +var minhz=1; +for(let iii=0;iii{ + startTime = data.toString().substring(10,23); + console.log("同步文件写入的开始时间戳为:"+startTime); +}); +fs.readFile("./files/999",(error,data)=>{ + endTime = data.toString().substring(10,23); + console.log("同步文件写入的结束时间戳为:"+endTime); +}); +setTimeout(() => { + console.log("方法二同步创建1000个文件消耗的的时间为:"+(endTime-startTime)+"ms") +}, 2000); + +// 异步写入 +setTimeout(() => { + var t1=new Date().getTime(); + for(let j=0;j<1000;j++){ + var nowDate = new Date(); + var fileName = "./files/D"+j; + fs.writeFile(fileName,"写入文件的时间戳为:"+nowDate.getTime()+"ms,写入文件的时间为:"+nowDate.toLocaleString(),(error,data)=>{}); + } + var t2=new Date().getTime(); + console.log("异步创建1000个文件消耗的时间为:"+(t2-t1)+"ms"); +}, 2500); + diff --git "a/\346\234\261\347\253\240\345\275\254/.keep" "b/\346\234\261\347\253\240\345\275\254/.keep" deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git "a/\346\234\261\347\253\240\345\275\254/\344\275\234\344\270\232/.keep" "b/\346\234\261\347\253\240\345\275\254/\344\275\234\344\270\232/.keep" deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git "a/\346\234\261\347\253\240\345\275\254/\344\275\234\344\270\232/\346\226\207\344\273\266\350\257\273\345\217\226/.keep" "b/\346\234\261\347\253\240\345\275\254/\344\275\234\344\270\232/\346\226\207\344\273\266\350\257\273\345\217\226/.keep" deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git "a/\346\234\261\347\253\240\345\275\254/\344\275\234\344\270\232/\346\226\207\344\273\266\350\257\273\345\217\226/demo.js" "b/\346\234\261\347\253\240\345\275\254/\344\275\234\344\270\232/\346\226\207\344\273\266\350\257\273\345\217\226/demo.js" deleted file mode 100644 index d64e6a82d81fdb47a36f6c6ca6eab24b6eb3609a..0000000000000000000000000000000000000000 --- "a/\346\234\261\347\253\240\345\275\254/\344\275\234\344\270\232/\346\226\207\344\273\266\350\257\273\345\217\226/demo.js" +++ /dev/null @@ -1,20 +0,0 @@ -let fs = require("fs"); -for (let i = 1; i <=100; i++) { - fs.writeFileSync("./"+i+".txt",String( Math.floor(Math.random() * 1001))); -} - -let max=0; -for (let i = 1; i <=100; i++) { - - - let data = fs.readFileSync("./"+i+".txt"); - - - console.log(Number(data.toString())); - if(Number(data.toString())>=max){ - max=Number(data.toString()); - } - - -} -console.log("最大值为"+max); diff --git "a/\346\234\261\347\253\240\345\275\254/\344\275\234\344\270\232/\346\250\241\345\235\227/.keep" "b/\346\234\261\347\253\240\345\275\254/\344\275\234\344\270\232/\346\250\241\345\235\227/.keep" deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git "a/\346\234\261\347\253\240\345\275\254/\344\275\234\344\270\232/\346\250\241\345\235\227/module.js" "b/\346\234\261\347\253\240\345\275\254/\344\275\234\344\270\232/\346\250\241\345\235\227/module.js" deleted file mode 100644 index 1a5d83370e8e51147cb8eb56d5abb6d1d12b27fc..0000000000000000000000000000000000000000 --- "a/\346\234\261\347\253\240\345\275\254/\344\275\234\344\270\232/\346\250\241\345\235\227/module.js" +++ /dev/null @@ -1,31 +0,0 @@ -function jia(a,b) { - if(a!=/^\d+$/ ||b!=/^\d+$/){ - return "请输入数字" ; - }else{ - return a+b; -}} - - -function jian(a,b) { - if(a!=/^\d+$/ ||b!=/^\d+$/){ - return "请输入数字" ; - }else{ - return a-b; -}} -function cheng(a,b) { - if(a!=/^\d+$/ ||b!=/^\d+$/){ - return "请输入数字" ; - }else{ - return a*b; -}} -function chu(a,b) { - if(a!=/^\d+$/ ||b!=/^\d+$/){ - return "请输入数字" ; - }else{ - return a/b; -}} - -module.exports.jia =jia; -module.exports.jian =jian; -module.exports.cheng =cheng; -module.exports.chu =chu; \ No newline at end of file diff --git "a/\346\234\261\347\253\240\345\275\254/\344\275\234\344\270\232/\346\250\241\345\235\227/use.js" "b/\346\234\261\347\253\240\345\275\254/\344\275\234\344\270\232/\346\250\241\345\235\227/use.js" deleted file mode 100644 index 526c84795f931f9c8a84a0bb001622acc9b28fb9..0000000000000000000000000000000000000000 --- "a/\346\234\261\347\253\240\345\275\254/\344\275\234\344\270\232/\346\250\241\345\235\227/use.js" +++ /dev/null @@ -1,9 +0,0 @@ -let result=require("./module"); -console.log(result); - - -console.log(result.jia("x",2)); -console.log(result.jia(2,2)); -console.log(result.jian(50,2)); -console.log(result.cheng(50,2)); -console.log(result.chu(50,2)); \ No newline at end of file diff --git "a/\346\235\216\345\255\220\344\272\221/2-13/\347\254\224\350\256\260.txt" "b/\346\235\216\345\255\220\344\272\221/2-13/\347\254\224\350\256\260.txt" deleted file mode 100644 index 87f962f579ceaaa2306529691b6ad7ab53767f2a..0000000000000000000000000000000000000000 --- "a/\346\235\216\345\255\220\344\272\221/2-13/\347\254\224\350\256\260.txt" +++ /dev/null @@ -1,7 +0,0 @@ -git branch 显示分支 -git branch 分支名 创建分支 -git add 添加文件 -git status 添加到当前分支 -git checkout 分支名 切换分支 -commit -m '内容' 上传 -push 提交 diff --git "a/\346\235\216\345\255\220\344\272\221/2-15 \345\205\250\345\261\200\345\222\214\346\250\241\345\235\227/jie.js" "b/\346\235\216\345\255\220\344\272\221/2-15 \345\205\250\345\261\200\345\222\214\346\250\241\345\235\227/jie.js" deleted file mode 100644 index bf2b64553e4d12370c89f86c846fe0f4037a20a3..0000000000000000000000000000000000000000 --- "a/\346\235\216\345\255\220\344\272\221/2-15 \345\205\250\345\261\200\345\222\214\346\250\241\345\235\227/jie.js" +++ /dev/null @@ -1,5 +0,0 @@ -let obj=require('./zy') -console.log(obj.jia(3,1)) -console.log(obj.jian(6,1)) -console.log(obj.cheng(2,1)) -console.log(obj.chu(2,1)) \ No newline at end of file diff --git "a/\346\235\216\345\255\220\344\272\221/2-15 \345\205\250\345\261\200\345\222\214\346\250\241\345\235\227/zy.js" "b/\346\235\216\345\255\220\344\272\221/2-15 \345\205\250\345\261\200\345\222\214\346\250\241\345\235\227/zy.js" deleted file mode 100644 index e796b7a4396ca667209c29c1d097ed722540a8dd..0000000000000000000000000000000000000000 --- "a/\346\235\216\345\255\220\344\272\221/2-15 \345\205\250\345\261\200\345\222\214\346\250\241\345\235\227/zy.js" +++ /dev/null @@ -1,43 +0,0 @@ -// ### 作业:写个加减乘除的模块(尽量少写暴露,要考虑复用性),供外部使用. 作业每个分支要建一个目录(自己名字) -let jieguo; -let obj={ - jia:function(a,b){ - if(Number(a) && Number(b)){ - jieguo=Number(a)+Number(b) - }else{ - jieguo="输入的必须为数字" - } - - return jieguo; - }, - jian:function(a,b){ - if(Number(a) && Number(b)){ - jieguo=Number(a)-Number(b) - }else{ - jieguo="输入的必须为数字" - } - - return jieguo; - }, - cheng:function(a,b){ - if(Number(a) && Number(b)){ - jieguo=Number(a)*Number(b) - }else{ - jieguo="输入的必须为数字" - } - - return jieguo; - }, - chu:function(a,b){ - if(Number(a) && Number(b)){ - jieguo=Number(a)/Number(b) - }else{ - jieguo="输入的必须为数字" - } - - return jieguo; - }, - - -} -module.exports=obj \ No newline at end of file diff --git "a/\346\235\216\345\255\220\344\272\221/2-16\344\275\234\344\270\232/zy.js" "b/\346\235\216\345\255\220\344\272\221/2-16\344\275\234\344\270\232/zy.js" deleted file mode 100644 index c2401f269f2f5ab2fff0913ac58c707d33cdd729..0000000000000000000000000000000000000000 --- "a/\346\235\216\345\255\220\344\272\221/2-16\344\275\234\344\270\232/zy.js" +++ /dev/null @@ -1,30 +0,0 @@ -// ## 作业:生成100个文件,每个文件存入一个1到1000的随机数字,再取出最大值的那个文件,值也要取出来,再取出最小的那个. -let fs=require("fs"); -let shu=[] -let max=0 -let maxwj=0; - -let min=1001; -let minwj=0; -for(let i=1;i<101;i++){ - //创建随机数 - let num=Math.ceil(Math.random()*1000); - //创建一百个文件并且赋值随机数 - fs.writeFileSync("./"+i+".txt",""+num+""); - //读取一百个文件内容并且存入数组 - shu[i]=(fs.readFileSync("./"+i+".txt").toString()); - //最大值 - if(Number(shu[i])>max){ - max=Number(shu[i]) - maxwj=i; - } - //找最小 - if(Number(shu[i]) max) { - max = num; - Max_fileName = i + ".txt"; - } - if (num < min) { - min = num; - Min_fileName = i + ".txt"; - } -} - -console.log("最大的文件"+Max_fileName,"最大值"+max,"最小的文件"+Min_fileName,"最小值"+min);