diff --git "a/\346\235\216\346\254\247\351\233\257/2.21-node\344\273\213\347\273\215\344\270\216\346\250\241\345\235\227/moduleA.js" "b/\346\235\216\346\254\247\351\233\257/2.21-node\344\273\213\347\273\215\344\270\216\346\250\241\345\235\227/moduleA.js" new file mode 100644 index 0000000000000000000000000000000000000000..8cd47ebf26de75c39d934855c6ddb505e9782c34 --- /dev/null +++ "b/\346\235\216\346\254\247\351\233\257/2.21-node\344\273\213\347\273\215\344\270\216\346\250\241\345\235\227/moduleA.js" @@ -0,0 +1,19 @@ +function add(a,b){ + return a + b; +} +function reduce(a,b){ + return a - b; +} +function multiple(a,b){ + return a * b; +} +function divide(a,b){ + return a / b; +} +//暴露 +module.exports = { + add:add, + reduce:reduce, + multiple:multiple, + divide:divide +} \ No newline at end of file diff --git "a/\346\235\216\346\254\247\351\233\257/2.21-node\344\273\213\347\273\215\344\270\216\346\250\241\345\235\227/moduleB.js" "b/\346\235\216\346\254\247\351\233\257/2.21-node\344\273\213\347\273\215\344\270\216\346\250\241\345\235\227/moduleB.js" new file mode 100644 index 0000000000000000000000000000000000000000..d12805bc576cbfbc19842f169f5359492a57176d --- /dev/null +++ "b/\346\235\216\346\254\247\351\233\257/2.21-node\344\273\213\347\273\215\344\270\216\346\250\241\345\235\227/moduleB.js" @@ -0,0 +1,6 @@ +//引入moduleA模块 +let moduleA = require("./moduleA"); +console.log(moduleA.add(1.3,2)); +console.log(moduleA.reduce(1,2)); +console.log(moduleA.multiple(3,2)); +console.log(moduleA.divide(5,2)); \ No newline at end of file