Node.js 函数

一个函数可以作为另一个函数的参数

function fn1(fn,arg){
    fn(arg);
}

 name(n){
    console.log("i am "+n);
}

fn1(name,"cyy");

 

 

使用匿名函数

(n){
    console.log("i am "+n);
},"cyy2");

 

 

HTTP服务器实例:

var http=require("http");

http.createServer((request,response){
    response.writeHead(200,{"Content-Type":"text/plain"});
    response.write("hello http~");
    response.end();
}).listen(8888);

 

 

 

相关文章

kindeditor4.x代码高亮功能默认使用的是prettify插件,prett...
这一篇我将介绍如何让kindeditor4.x整合SyntaxHighlighter代...
js如何实现弹出form提交表单?(图文+视频)
js怎么获取复选框选中的值
js如何实现倒计时跳转页面
如何用js控制图片放大缩小