课程代码
This commit is contained in:
18
nodejs/nodeExperiment2/myModule.js
Normal file
18
nodejs/nodeExperiment2/myModule.js
Normal file
@@ -0,0 +1,18 @@
|
||||
// 属性
|
||||
const author = "harry";
|
||||
|
||||
// 方法
|
||||
function greet(name) {
|
||||
return `Hello, ${name}`;
|
||||
}
|
||||
|
||||
function add(a, b) {
|
||||
return a + b;
|
||||
}
|
||||
|
||||
// 共享属性 author 和 greet()、add()方法
|
||||
module.exports = {
|
||||
author,
|
||||
greet,
|
||||
add
|
||||
};
|
||||
Reference in New Issue
Block a user