一個函式可以作為另一個函式的引數
function fn1(fn,arg){ fn(arg); } function name(n){ console.log("i am "+n); } fn1(name,"cyy");

使用匿名函式
function fn1(fn,arg){ fn(arg); } fn1(function(n){ console.log("i am "+n); },"cyy2");

HTTP服務器實體:
var http=require("http"); http.createServer(function(request,response){ response.writeHead(200,{"Content-Type":"text/plain"}); response.write("hello http~"); response.end(); }).listen(8888);


轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/143531.html
標籤:JavaScript
上一篇:Node.js模塊系統
下一篇:Node.js 路由
