麻烦帮我看一下第二个函数哪里出了问题
<!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <title>参数的个数</title> </head> <body> <script type="text/javascript"> // 在此处补充代码 function compareMin(a,b){ if(a>b){ return a; }else{ return b; } } document.write(compareMin(21,42)); document.write('<br/>'); function comMin(){ var minArr = []; if(arguments.length == 0)return 'please enter a values'; document.write(arguments.sort(function(a,b){return a-b})[0]); } document.write(comMin(1,2,3,4,5,6,7,8)); </script> </body> </html>
22
收起
正在回答 回答被采纳积分+1
3回答
慕用9491247
2018-04-03 23:53:01
<!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <title>666</title> </head> <body> <script type="text/javascript"> function compareMin(a,b){ if(a>b){ return a; }else{ return b; } } document.write(compareMin(21,42)); document.write('<br/>'); function comMin(){ var minArr = []; for(var i=0; i < arguments.length; i++){ minArr.push(arguments[i]); } if(arguments.length == 0)return 'please enter a values'; return minArr.sort(function(a,b){return a-b}); } document.write(comMin(15,1,3,4,5,6,2,7)); </script> </body> </html>
江城fen
2018-03-25 03:20:48
<!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <title>参数的个数</title> </head> <body> <script type="text/javascript"> // 在此处补充代码 function compareMin(a,b){ if(a>b){ return a; }else{ return b; } } document.write(compareMin(21,42)); document.write('<br/>'); function comMin(){ var minArr = []; if(arguments.length == 0)return 'please enter a values'; document.write(arguments.sort(function(a,b){return a-b})[0]); } document.write(comMin(1,2,3,4,5,6,7,8)); </script> </body> </html>
进击JavaScript核心 2018
- 参与学习 466 人
- 提交作业 74 份
- 解答问题 635 个
JavaScript不仅能实现静态页面到动态特效的转变,还能完成数据的动态交互,但是关于js到底功能有多强大,大家还是有所期待的,本路径将带你深入到js中,一一揭开JavaScript的神秘面纱。
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星