【发布时间】:2020-05-15 04:14:32
【问题描述】:
有点愚蠢的问题,只是想试试是否可以避免所需模块的名称。
例如:
const MATH = require('./maths.js');
HTTP.createServer(function (request, response) {
response.write("Add 1 and 5: " + MATH.add(1, 5));
}).listen(8080);
// Add in the maths module
// function add(a, b) {
// return a + b;
// }
我可以做一些以下事情吗?
response.write("加1和5:" + add(1,5));
【问题讨论】:
标签: javascript node.js function module node-modules