From 61b67309205ff4b51a97b737773cc10781ec3a06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=BE=E9=9D=92=E5=87=A4?= <2658978250@qq.com> Date: Thu, 16 Feb 2023 08:38:46 +0000 Subject: [PATCH] work2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 曾青凤 <2658978250@qq.com> --- .../work2.js" | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 "\346\233\276\351\235\222\345\207\244/\346\226\207\344\273\266\350\257\273\345\217\226\344\275\234\344\270\232/work2.js" diff --git "a/\346\233\276\351\235\222\345\207\244/\346\226\207\344\273\266\350\257\273\345\217\226\344\275\234\344\270\232/work2.js" "b/\346\233\276\351\235\222\345\207\244/\346\226\207\344\273\266\350\257\273\345\217\226\344\275\234\344\270\232/work2.js" new file mode 100644 index 0000000..8490d9e --- /dev/null +++ "b/\346\233\276\351\235\222\345\207\244/\346\226\207\344\273\266\350\257\273\345\217\226\344\275\234\344\270\232/work2.js" @@ -0,0 +1,25 @@ +'use strict'; + +var fs = require('fs'); + +var max=0; +var maxfile=''; + + +for (let index =1; index <=3; index++) { + +//写入随机文件和文本内容 + var num = Math.floor(Math.random()*(200-1+1)+1);//(max-min+1)+min + var txt = ""+num+"" + fs.writeFileSync("./"+num+".txt",txt); + + +if (Number(txt)>max) { + max = Number(txt); + maxfile="./"+num+".txt"; +} + + +} + +console.log(maxfile); \ No newline at end of file -- Gitee