node

97 阅读1分钟
  1. Object.prototype 产生是空对象
    Function.prototype 产生是function(){}
  2. 延时方法 setTimeout setInterval process.nextTick() requestAniamtionFrame
  3. setTImeout 异步变成同步
for(var i=0;i<10;i++){
	var m=i;
	//同步代码  定义同步方法
	exec(m,function(m){
		console.log(m);
	})

}

function exec(param,callback){
	//callback 一定是异步的吗?
	setTimeout(function(){
		callback(param);
	},0)
}

console.log("end");