时间:2021-07-01 10:21:17 帮助过:36人阅读
[code]function execute(someFn, value) {
someFn(value);
}
execute(function (word) {
console.log(word)
}, 'hello');
函数传递是如何让HTTP服务工作的
案例:server.js
[code]var http = require('http');
var onRequest = function (request, response) {
response.writeHead(200, { "Content-Type" : "text/plain"});
response.write("Hello world");
response.end();
}
http.createServer(onRequest).listen(8888);
console.log('服务器监听端口 8888');
客户端:http://localhost:8888/%E5%87%BD%E6%95%B0/server.js

以上就是Node.js 函数的内容,更多相关内容请关注PHP中文网(www.gxlcms.com)!