1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
| <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> </head> <body> </body> </html> <script type="text/javascript">
function say(){ document.write("宝贝儿<br />"); } say(); say(); say(); function print(a){ document.write("执行了函数print<br />"); document.write(a); } print(666+"<br />"); function sum(a,b,c){ document.write("执行了函数sum<br />"); document.write(a+b+c+"<br />"); } sum(1,2,3); sum(1,"spring",3); sum(1,2); function buyMilk1(){ document.write("执行了函数buyMilk1<br />"); var a=1; return a; } document.write(buyMilk1()+"<br />"); function buyMilk2(){ document.write("执行了函数buyMilk2<br />"); var a=1; var b=2; return [a,b]; } document.write(buyMilk2()+"<br />"); var n=buyMilk2(); document.write(n+"<br />"); function buyMilk3(a,b,c){ document.write("执行了函数buyMilk3<br />"); return a+b+c; } document.write(buyMilk3(1,2,3)+"<br />"); var n=buyMilk3(1,2,3); document.write(n+"<br />"); function max(a,b){ document.write("执行了函数max<br />"); return a>b?a:b;; } document.write(max(1,2)+"<br />"); function math(a){ document.write("执行了函数math<br />"); for(var i=1;i<=a;i++){ if(a%i==0){ document.write(i+" "); } } } math(24); document.write("<br />"); function max(a){ document.write("执行了函数max<br />"); for(var i=0;i<a.length;i++){ if(i==0){ var max=a[i]; } if(max<a[i]){ max=a[i]; } } return max; } var b=[1,2,3,4,6,,19,7,9] document.write(max(b)+"<br />"); document.write(max([1,2,3,4,11,7,9])); </script>
|