这是我的代码中,有2个文件:为什么不打印日期?
文件b.js
module.exports.data = function() {
return new Date();
}
文件a.js
var a = require("./b")
var http = require('http')
http.createServer(function(req, res) {
res.writeHead(200, {'Content-type':'text/plain'})
res.write('the date is: '+a.data)
res.end();
}).listen(8000)
为什么不打印日期?
您需要使用'a.data()''不a.data' – itsundefined