摘要:
匿名函数递归1functionfactorial(num){2if(num<=1){3return1;4}else{5returnnum*arguments.callee(num-1);6}7}命名函数递归1functionfactorial(num){2if(num<=1){3return1;4}else{5returnnum*factorial(num-1);6}7}调用函数1vartrueFactorial=factorial;2factorial=function(){3return0;4};5console.log(trueFactorial(5));6console.l 阅读全文
摘要:
父页面1<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">2<htmlxmlns="http://www.w3.org/1999/xhtml">3<head>4<metahttp-equiv="Content-Type"content="text/html;charset=UTF-8&qu 阅读全文
摘要:
1functioncreateComparisonFunction(propertyName){2returnfunction(object1,object2){3varvalue1=object1[propertyName];4varvalue2=object2[propertyName];56if(value1<value2){7return-1;8}elseif(value1>value2){9return1;10}else{11return0;12}13};14}1516vardata=[17{name:"Zachary",age:28},18{name 阅读全文