From 665cdea30d42bee67aa34821fade3b43ac624968 Mon Sep 17 00:00:00 2001 From: unknown <635484824@qq.com> Date: Mon, 13 Feb 2023 16:32:12 +0800 Subject: [PATCH 1/2] zengman --- "\346\233\276\346\273\241/\345\206\205\345\256\271.txt" | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 "\346\233\276\346\273\241/\345\206\205\345\256\271.txt" diff --git "a/\346\233\276\346\273\241/\345\206\205\345\256\271.txt" "b/\346\233\276\346\273\241/\345\206\205\345\256\271.txt" new file mode 100644 index 0000000..e69de29 -- Gitee From 559e9045a4ea7bc0bfb5f6110bcdbec92b3f1b31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=BE=E6=BB=A1?= <635484824@qq.com> Date: Thu, 16 Feb 2023 05:38:56 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=E6=A8=A1=E5=9D=97=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 曾满 <635484824@qq.com> --- .../moudle.js" | 56 +++++++++++++++++++ .../use.js" | 18 ++++++ 2 files changed, 74 insertions(+) create mode 100644 "\346\233\276\346\273\241/\347\254\254\344\270\200\346\254\241\344\275\234\344\270\232/moudle.js" create mode 100644 "\346\233\276\346\273\241/\347\254\254\344\270\200\346\254\241\344\275\234\344\270\232/use.js" diff --git "a/\346\233\276\346\273\241/\347\254\254\344\270\200\346\254\241\344\275\234\344\270\232/moudle.js" "b/\346\233\276\346\273\241/\347\254\254\344\270\200\346\254\241\344\275\234\344\270\232/moudle.js" new file mode 100644 index 0000000..7a2d382 --- /dev/null +++ "b/\346\233\276\346\273\241/\347\254\254\344\270\200\346\254\241\344\275\234\344\270\232/moudle.js" @@ -0,0 +1,56 @@ +module.exports={ + //加 + add: function (a,b) { + if(this.error(a,b)){ + console.log('加法'); + return a+b; + }else{ + console.log('加法输入错误'); + } + + }, + //减 + subtract: function (a,b){ + if(this.error(a,b)){ + console.log('减法'); + return a-b; + }else{ + console.log('减法输入错误'); + } + + }, + + //乘 + multiply: function (a,b){ + if(this.error(a,b)){ + console.log('乘法'); + return a*b; + }else{ + console.log('乘法输入错误'); + } + + }, + + //除 + divide: function (a,b){ + if(this.error(a,b)){ + + if(b==0){ + console.log('除数为0,错误') + } + console.log('除法'); + return a/b; + }else{ + console.log('除法输入错误'); + } + + }, + error: (a, b) => { + if (isNaN(a) == true || isNaN(b) == true) { + return false; + } else { + return true; + } + } + +} \ No newline at end of file diff --git "a/\346\233\276\346\273\241/\347\254\254\344\270\200\346\254\241\344\275\234\344\270\232/use.js" "b/\346\233\276\346\273\241/\347\254\254\344\270\200\346\254\241\344\275\234\344\270\232/use.js" new file mode 100644 index 0000000..9d7d252 --- /dev/null +++ "b/\346\233\276\346\273\241/\347\254\254\344\270\200\346\254\241\344\275\234\344\270\232/use.js" @@ -0,0 +1,18 @@ +// const { add } = require("./moudle.js"); +// console.log(add(5,5)); +// const { subtract } = require("./moudle.js"); +// console.log(subtract(13,4)); +// const { multiply } = require("./moudle.js"); +// console.log(multiply(2,4)); +// const { divide } = require("./moudle.js"); +// console.log(divide(10,10)); + +var obj= require("./moudle.js"); + +console.log(obj.add(5,5)); + +console.log(obj.subtract(13,4)); + +console.log(obj.multiply(2,4)); + +console.log(obj.divide(10,0)); \ No newline at end of file -- Gitee