匿名函数:scope.js
[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 函数的内容。
