1 <script type="text/javascript"> 2 3 function add(num1,num2) 4 { return num1+num2+200;} 5 var sum=add(122,10000); 6 window.document.write(sum); 7 8 </script> 9 <script type="text/javascript"> 10 var add=new Function("num"," return num+200"); //此时Function 这种方法用的比较少 11 var sum=add(122); 12 window.document.write(sum); 13 14 </script> 15 16 17 <script type="text/javascript"> 18 19 var add=function(num1,num2){ return num1+num2+200;} 20 var sum=add(122,300); 21 window.document.write(sum); 22 </script>