From cc3de4bc688e98e9bc35e4bf9f58c58baa8b9800 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E9=9B=AA=E9=9B=A8?= <3335487719@qq.com> Date: Wed, 15 Feb 2023 03:31:04 +0000 Subject: [PATCH 1/6] =?UTF-8?q?=E6=96=B0=E5=BB=BA=20=E6=9C=B1=E9=9B=AA?= =?UTF-8?q?=E9=9B=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- "\346\234\261\351\233\252\351\233\250/.keep" | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 "\346\234\261\351\233\252\351\233\250/.keep" diff --git "a/\346\234\261\351\233\252\351\233\250/.keep" "b/\346\234\261\351\233\252\351\233\250/.keep" new file mode 100644 index 0000000..e69de29 -- Gitee From abd5c8b72aedaac298c90912144d0acfabc926c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E9=9B=AA=E9=9B=A8?= <3335487719@qq.com> Date: Wed, 15 Feb 2023 03:31:54 +0000 Subject: [PATCH 2/6] =?UTF-8?q?=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 朱雪雨 <3335487719@qq.com> --- .../\346\250\241\345\235\227/jjcc.js" | 18 ++++++++++++++++++ .../\346\250\241\345\235\227/use.js" | 9 +++++++++ 2 files changed, 27 insertions(+) create mode 100644 "\346\234\261\351\233\252\351\233\250/\346\250\241\345\235\227/jjcc.js" create mode 100644 "\346\234\261\351\233\252\351\233\250/\346\250\241\345\235\227/use.js" diff --git "a/\346\234\261\351\233\252\351\233\250/\346\250\241\345\235\227/jjcc.js" "b/\346\234\261\351\233\252\351\233\250/\346\250\241\345\235\227/jjcc.js" new file mode 100644 index 0000000..3712bc5 --- /dev/null +++ "b/\346\234\261\351\233\252\351\233\250/\346\250\241\345\235\227/jjcc.js" @@ -0,0 +1,18 @@ +let obj={ + jia:function(a,b){ + + // if(!isNaN(parseFloat(a)) && isFinite(a)){ + return a+b; + // } + }, + jian:function(a,b){ + return a-b; + }, + cheng:function(a,b){ + return a*b; + }, + chu:function(a,b){ + return a/b; + } +} +module.exports=obj; \ No newline at end of file diff --git "a/\346\234\261\351\233\252\351\233\250/\346\250\241\345\235\227/use.js" "b/\346\234\261\351\233\252\351\233\250/\346\250\241\345\235\227/use.js" new file mode 100644 index 0000000..39da382 --- /dev/null +++ "b/\346\234\261\351\233\252\351\233\250/\346\250\241\345\235\227/use.js" @@ -0,0 +1,9 @@ +let obj=require("./jjcc.js"); +let jia= obj.jia(a,5); +console.log(jia); +// let jian= obj.jian(3,5); +// console.log(jian); +// let cheng= obj.cheng(3,5); +// console.log(cheng); +// let chu= obj.chu(3,5); +// console.log(chu); \ No newline at end of file -- Gitee From a7c701ffb3f13f35fc0fa4d849110f12ad9c924d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E9=9B=AA=E9=9B=A8?= <3335487719@qq.com> Date: Thu, 16 Feb 2023 12:19:16 +0000 Subject: [PATCH 3/6] =?UTF-8?q?=E6=96=B0=E5=BB=BA=20=E8=AF=BB=E5=8F=96?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E4=B8=8E=E5=86=99=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../.keep" | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 "\346\234\261\351\233\252\351\233\250/\350\257\273\345\217\226\346\226\207\344\273\266\344\270\216\345\206\231\345\205\245/.keep" diff --git "a/\346\234\261\351\233\252\351\233\250/\350\257\273\345\217\226\346\226\207\344\273\266\344\270\216\345\206\231\345\205\245/.keep" "b/\346\234\261\351\233\252\351\233\250/\350\257\273\345\217\226\346\226\207\344\273\266\344\270\216\345\206\231\345\205\245/.keep" new file mode 100644 index 0000000..e69de29 -- Gitee From 2a09a1bdf083869f0567e219d04b25e20eff010b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E9=9B=AA=E9=9B=A8?= <3335487719@qq.com> Date: Thu, 16 Feb 2023 12:20:00 +0000 Subject: [PATCH 4/6] =?UTF-8?q?=E8=AF=BB=E5=8F=96=E4=B8=8E=E5=86=99?= =?UTF-8?q?=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 朱雪雨 <3335487719@qq.com> --- .../xie.js" | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 "\346\234\261\351\233\252\351\233\250/\350\257\273\345\217\226\346\226\207\344\273\266\344\270\216\345\206\231\345\205\245/xie.js" diff --git "a/\346\234\261\351\233\252\351\233\250/\350\257\273\345\217\226\346\226\207\344\273\266\344\270\216\345\206\231\345\205\245/xie.js" "b/\346\234\261\351\233\252\351\233\250/\350\257\273\345\217\226\346\226\207\344\273\266\344\270\216\345\206\231\345\205\245/xie.js" new file mode 100644 index 0000000..c8d7b57 --- /dev/null +++ "b/\346\234\261\351\233\252\351\233\250/\350\257\273\345\217\226\346\226\207\344\273\266\344\270\216\345\206\231\345\205\245/xie.js" @@ -0,0 +1,31 @@ +//作业:生成100个文件,每个文件存入一个1到1000的随机数字, +//再取出最大值的那个文件,值也要取出来,再取出最小的那个. + +//生成100个文件 +let fs=require("fs"); +let x=0; +let n=50000; +let wzx; +let wzn; +for (let i = 0; i < 100; i++) { + let bb=Math.ceil(Math.random()*1000); + fs.writeFileSync("./"+i+".txt",""+bb); +} +var arr= new Array(); + +var zhi=new Array(); +for(let j = 0; j < 100; j++){ +let readwen= fs.readFileSync("./"+j+".txt"); +arr[j]=Number(readwen.toString()); +zhi[j]="./"+j+".txt"; +if(arr[j]>x){ +x=arr[j]; +wzx=zhi[j]; +} +if(arr[j] Date: Sun, 19 Feb 2023 01:29:32 +0000 Subject: [PATCH 5/6] =?UTF-8?q?=E6=96=B0=E5=BB=BA=20=E8=AE=A1=E7=AE=97?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=BF=90=E8=A1=8C=E7=9A=84=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../.keep" | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 "\346\234\261\351\233\252\351\233\250/\350\256\241\347\256\227\344\273\243\347\240\201\350\277\220\350\241\214\347\232\204\346\227\266\351\227\264/.keep" diff --git "a/\346\234\261\351\233\252\351\233\250/\350\256\241\347\256\227\344\273\243\347\240\201\350\277\220\350\241\214\347\232\204\346\227\266\351\227\264/.keep" "b/\346\234\261\351\233\252\351\233\250/\350\256\241\347\256\227\344\273\243\347\240\201\350\277\220\350\241\214\347\232\204\346\227\266\351\227\264/.keep" new file mode 100644 index 0000000..e69de29 -- Gitee From c3de23dd04731469c36fd89554a88bb703c79dda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E9=9B=AA=E9=9B=A8?= <3335487719@qq.com> Date: Sun, 19 Feb 2023 01:30:08 +0000 Subject: [PATCH 6/6] =?UTF-8?q?=E6=9C=B1=E9=9B=AA=E9=9B=A8=20=E4=B8=A4?= =?UTF-8?q?=E4=BB=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 朱雪雨 <3335487719@qq.com> --- .../jishuan/jishuan.js" | 17 +++++++++++++++++ .../jishuan/xie.js" | 10 ++++++++++ 2 files changed, 27 insertions(+) create mode 100644 "\346\234\261\351\233\252\351\233\250/\350\256\241\347\256\227\344\273\243\347\240\201\350\277\220\350\241\214\347\232\204\346\227\266\351\227\264/jishuan/jishuan.js" create mode 100644 "\346\234\261\351\233\252\351\233\250/\350\256\241\347\256\227\344\273\243\347\240\201\350\277\220\350\241\214\347\232\204\346\227\266\351\227\264/jishuan/xie.js" diff --git "a/\346\234\261\351\233\252\351\233\250/\350\256\241\347\256\227\344\273\243\347\240\201\350\277\220\350\241\214\347\232\204\346\227\266\351\227\264/jishuan/jishuan.js" "b/\346\234\261\351\233\252\351\233\250/\350\256\241\347\256\227\344\273\243\347\240\201\350\277\220\350\241\214\347\232\204\346\227\266\351\227\264/jishuan/jishuan.js" new file mode 100644 index 0000000..994f74e --- /dev/null +++ "b/\346\234\261\351\233\252\351\233\250/\350\256\241\347\256\227\344\273\243\347\240\201\350\277\220\350\241\214\347\232\204\346\227\266\351\227\264/jishuan/jishuan.js" @@ -0,0 +1,17 @@ +// 计算同步和异步写入1000个文件的时间。 +let fs=require("fs"); +var time1=new Date().getTime(); +for (let i = 0; i < 1000; i++) { + let fliei="./text/"+i+".txt"; + fs.writeFileSync(fliei,Math.ceil(Math.random()*1000)+""); +} +var time2=new Date().getTime(); +console.log("同步"+time2-time1+"毫秒"); +var time3=new Date().getTime(); +for (let j = 0; j < 1000; j++) { + let fliei="./text1/"+j+".txt"; + fs.writeFile(fliei,Math.ceil(Math.random()*1000)+"",function(err){ +}); +} +var time4=new Date().getTime(); +console.log("异步"+time4-time3+"毫秒"); \ No newline at end of file diff --git "a/\346\234\261\351\233\252\351\233\250/\350\256\241\347\256\227\344\273\243\347\240\201\350\277\220\350\241\214\347\232\204\346\227\266\351\227\264/jishuan/xie.js" "b/\346\234\261\351\233\252\351\233\250/\350\256\241\347\256\227\344\273\243\347\240\201\350\277\220\350\241\214\347\232\204\346\227\266\351\227\264/jishuan/xie.js" new file mode 100644 index 0000000..dd04134 --- /dev/null +++ "b/\346\234\261\351\233\252\351\233\250/\350\256\241\347\256\227\344\273\243\347\240\201\350\277\220\350\241\214\347\232\204\346\227\266\351\227\264/jishuan/xie.js" @@ -0,0 +1,10 @@ +let fs=require("fs"); +console.time("同步运行时间"); +for (let i = 0; i < 1000; i++) { + fs.writeFileSync("./text/"+i+".txt",""+i);} +console.timeEnd("同步运行时间"); +console.time("异步运行时间"); +for (let j = 0; j < 1000; j++) { + let fliei="./text1/"+j+".txt"; + fs.writeFile(fliei,Math.ceil(Math.random()*1000)+"",function(err){})} +console.timeEnd("异步运行时间"); \ No newline at end of file -- Gitee