谁可以帮我分析下下面这段代码中dwn(add(5));和dwn(add(5)(10))的执行过程<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head> <title>无标题页</title></head><body><script><!--function dwn(s){ document.write(s+"<br />");}function trans(list,op){ for(var i=0;i<list.length; i++) { list[i]=op(list[i]); }}var list=[1,2,3,4,5];trans(list,function(x){return x+1;});dwn(list);trans(list,function(x){ return x*2;});dwn(list);function add(a,b){ b=b||0; var s=a+b; var ret=function(a) { return add(a,s); } ret.valueOo=ret.toString=function(){return s;} return ret;}dwn(add(5));dwn(add(5)(10)) --></script></body></html>
添加回答
举报
0/150
提交
取消