From fda2a41a74fb9c9394f57e0203fe5f7a582ecda0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E6=B6=A6=E5=B1=B1?= <1968965292@qq.com> Date: Wed, 2 Mar 2022 07:58:48 +0800 Subject: [PATCH] 1 --- .../2022-2-22nodejs/demo01.js" | 11 ++++ .../2022-2-22nodejs/demo02.js" | 28 +++++++++ .../2022-2-24nodejs/demo01.js" | 50 ++++++++++++++++ .../2022-3-1nodejs/demo01.js" | 58 +++++++++++++++++++ .../2022-3-1nodejs/splice/1.txt" | 1 + .../2022-3-1nodejs/splice/10.txt" | 1 + .../2022-3-1nodejs/splice/100.txt" | 1 + .../2022-3-1nodejs/splice/11.txt" | 1 + .../2022-3-1nodejs/splice/12.txt" | 1 + .../2022-3-1nodejs/splice/13.txt" | 1 + .../2022-3-1nodejs/splice/14.txt" | 1 + .../2022-3-1nodejs/splice/15.txt" | 1 + .../2022-3-1nodejs/splice/16.txt" | 1 + .../2022-3-1nodejs/splice/17.txt" | 1 + .../2022-3-1nodejs/splice/18.txt" | 1 + .../2022-3-1nodejs/splice/19.txt" | 1 + .../2022-3-1nodejs/splice/2.txt" | 1 + .../2022-3-1nodejs/splice/20.txt" | 1 + .../2022-3-1nodejs/splice/21.txt" | 1 + .../2022-3-1nodejs/splice/22.txt" | 1 + .../2022-3-1nodejs/splice/23.txt" | 1 + .../2022-3-1nodejs/splice/24.txt" | 1 + .../2022-3-1nodejs/splice/25.txt" | 1 + .../2022-3-1nodejs/splice/26.txt" | 1 + .../2022-3-1nodejs/splice/27.txt" | 1 + .../2022-3-1nodejs/splice/28.txt" | 1 + .../2022-3-1nodejs/splice/29.txt" | 1 + .../2022-3-1nodejs/splice/3.txt" | 1 + .../2022-3-1nodejs/splice/30.txt" | 1 + .../2022-3-1nodejs/splice/31.txt" | 1 + .../2022-3-1nodejs/splice/32.txt" | 1 + .../2022-3-1nodejs/splice/33.txt" | 1 + .../2022-3-1nodejs/splice/34.txt" | 1 + .../2022-3-1nodejs/splice/35.txt" | 1 + .../2022-3-1nodejs/splice/36.txt" | 1 + .../2022-3-1nodejs/splice/37.txt" | 1 + .../2022-3-1nodejs/splice/38.txt" | 1 + .../2022-3-1nodejs/splice/39.txt" | 1 + .../2022-3-1nodejs/splice/4.txt" | 1 + .../2022-3-1nodejs/splice/40.txt" | 1 + .../2022-3-1nodejs/splice/41.txt" | 1 + .../2022-3-1nodejs/splice/42.txt" | 1 + .../2022-3-1nodejs/splice/43.txt" | 1 + .../2022-3-1nodejs/splice/44.txt" | 1 + .../2022-3-1nodejs/splice/45.txt" | 1 + .../2022-3-1nodejs/splice/46.txt" | 1 + .../2022-3-1nodejs/splice/47.txt" | 1 + .../2022-3-1nodejs/splice/48.txt" | 1 + .../2022-3-1nodejs/splice/49.txt" | 1 + .../2022-3-1nodejs/splice/5.txt" | 1 + .../2022-3-1nodejs/splice/50.txt" | 1 + .../2022-3-1nodejs/splice/51.txt" | 1 + .../2022-3-1nodejs/splice/52.txt" | 1 + .../2022-3-1nodejs/splice/53.txt" | 1 + .../2022-3-1nodejs/splice/54.txt" | 1 + .../2022-3-1nodejs/splice/55.txt" | 1 + .../2022-3-1nodejs/splice/56.txt" | 1 + .../2022-3-1nodejs/splice/57.txt" | 1 + .../2022-3-1nodejs/splice/58.txt" | 1 + .../2022-3-1nodejs/splice/59.txt" | 1 + .../2022-3-1nodejs/splice/6.txt" | 1 + .../2022-3-1nodejs/splice/60.txt" | 1 + .../2022-3-1nodejs/splice/61.txt" | 1 + .../2022-3-1nodejs/splice/62.txt" | 1 + .../2022-3-1nodejs/splice/63.txt" | 1 + .../2022-3-1nodejs/splice/64.txt" | 1 + .../2022-3-1nodejs/splice/65.txt" | 1 + .../2022-3-1nodejs/splice/66.txt" | 1 + .../2022-3-1nodejs/splice/67.txt" | 1 + .../2022-3-1nodejs/splice/68.txt" | 1 + .../2022-3-1nodejs/splice/69.txt" | 1 + .../2022-3-1nodejs/splice/7.txt" | 1 + .../2022-3-1nodejs/splice/70.txt" | 1 + .../2022-3-1nodejs/splice/71.txt" | 1 + .../2022-3-1nodejs/splice/72.txt" | 1 + .../2022-3-1nodejs/splice/73.txt" | 1 + .../2022-3-1nodejs/splice/74.txt" | 1 + .../2022-3-1nodejs/splice/75.txt" | 1 + .../2022-3-1nodejs/splice/76.txt" | 1 + .../2022-3-1nodejs/splice/77.txt" | 1 + .../2022-3-1nodejs/splice/78.txt" | 1 + .../2022-3-1nodejs/splice/79.txt" | 1 + .../2022-3-1nodejs/splice/8.txt" | 1 + .../2022-3-1nodejs/splice/80.txt" | 1 + .../2022-3-1nodejs/splice/81.txt" | 1 + .../2022-3-1nodejs/splice/82.txt" | 1 + .../2022-3-1nodejs/splice/83.txt" | 1 + .../2022-3-1nodejs/splice/84.txt" | 1 + .../2022-3-1nodejs/splice/85.txt" | 1 + .../2022-3-1nodejs/splice/86.txt" | 1 + .../2022-3-1nodejs/splice/87.txt" | 1 + .../2022-3-1nodejs/splice/88.txt" | 1 + .../2022-3-1nodejs/splice/89.txt" | 1 + .../2022-3-1nodejs/splice/9.txt" | 1 + .../2022-3-1nodejs/splice/90.txt" | 1 + .../2022-3-1nodejs/splice/91.txt" | 1 + .../2022-3-1nodejs/splice/92.txt" | 1 + .../2022-3-1nodejs/splice/93.txt" | 1 + .../2022-3-1nodejs/splice/94.txt" | 1 + .../2022-3-1nodejs/splice/95.txt" | 1 + .../2022-3-1nodejs/splice/96.txt" | 1 + .../2022-3-1nodejs/splice/97.txt" | 1 + .../2022-3-1nodejs/splice/98.txt" | 1 + .../2022-3-1nodejs/splice/99.txt" | 1 + 104 files changed, 247 insertions(+) create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-2-22nodejs/demo01.js" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-2-22nodejs/demo02.js" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-2-24nodejs/demo01.js" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/demo01.js" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/1.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/10.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/100.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/11.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/12.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/13.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/14.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/15.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/16.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/17.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/18.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/19.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/2.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/20.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/21.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/22.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/23.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/24.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/25.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/26.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/27.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/28.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/29.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/3.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/30.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/31.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/32.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/33.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/34.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/35.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/36.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/37.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/38.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/39.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/4.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/40.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/41.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/42.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/43.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/44.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/45.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/46.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/47.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/48.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/49.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/5.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/50.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/51.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/52.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/53.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/54.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/55.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/56.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/57.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/58.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/59.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/6.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/60.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/61.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/62.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/63.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/64.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/65.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/66.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/67.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/68.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/69.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/7.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/70.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/71.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/72.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/73.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/74.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/75.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/76.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/77.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/78.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/79.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/8.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/80.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/81.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/82.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/83.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/84.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/85.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/86.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/87.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/88.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/89.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/9.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/90.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/91.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/92.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/93.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/94.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/95.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/96.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/97.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/98.txt" create mode 100644 "\351\273\204\346\266\246\345\261\261/2022-3-1nodejs/splice/99.txt" diff --git "a/\351\273\204\346\266\246\345\261\261/2022-2-22nodejs/demo01.js" "b/\351\273\204\346\266\246\345\261\261/2022-2-22nodejs/demo01.js" new file mode 100644 index 0000000..0fd6ad6 --- /dev/null +++ "b/\351\273\204\346\266\246\345\261\261/2022-2-22nodejs/demo01.js" @@ -0,0 +1,11 @@ +let math=require("./demo02") + +try{ + console.log(math.handle(2,3,"add")); + console.log(math.handle(6,3,"subtract")); + console.log(math.handle(3,3,"multiply")); + console.log(math.handle(6,3,"divide")); + console.log(math.handle(6,0,"divide")); +}catch(error){ + console.log(error.message); +} \ No newline at end of file diff --git "a/\351\273\204\346\266\246\345\261\261/2022-2-22nodejs/demo02.js" "b/\351\273\204\346\266\246\345\261\261/2022-2-22nodejs/demo02.js" new file mode 100644 index 0000000..46d1303 --- /dev/null +++ "b/\351\273\204\346\266\246\345\261\261/2022-2-22nodejs/demo02.js" @@ -0,0 +1,28 @@ +var count = { + add:function(a,b) { + return a+b; + }, + subtract:function subtract(a,b){ + return a-b; + }, + multiply:function multiply(a,b){ + return a*b; + }, + divide:function divide(a,b){ + return a/b; + } + +} + +function handle(a,b,funcname){ + if(isNaN(a)||isNaN(b)){ + throw new Error("请输入数字"); + } + if(funcname=="divide"&&b===0){ + throw new Error("0不能做除数"); + } + return count[funcname](a,b) + +} + +module.exports.handle = handle; diff --git "a/\351\273\204\346\266\246\345\261\261/2022-2-24nodejs/demo01.js" "b/\351\273\204\346\266\246\345\261\261/2022-2-24nodejs/demo01.js" new file mode 100644 index 0000000..574996f --- /dev/null +++ "b/\351\273\204\346\266\246\345\261\261/2022-2-24nodejs/demo01.js" @@ -0,0 +1,50 @@ +//写一段代码,可以指定的创建多个文件,文件名中要有序号,写入的内容可以随机 +let fs=require("fs") + +let createFile = { + /** + * 创建文件夹 + */ + createPath: function (dir) { + //文件夹可能存在 + if(fs.existsSync(dir)){ + return ; + } + fs.mkdirSync(dir); + }, + + /** + * 创建内容 + * + */ + createContent:function(num){ + return num+''; + }, + + /** + * 写入文件与内容 + * + */ + createFile:function(filePath,content){ + //flags w 可写 + console.log(filePath); + let fd = fs.openSync(filePath,'w'); + fs.writeSync(fd,content); + fs.closeSync(fd); + + }, + + handle:function(num,dir){ + //目录不存在则创建 + this.createPath(dir); + //循环的创建文件与内容 + for(let i=1;i