1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 6 <title>函數的調用方式</title> 7 </head> 8 <script> 9 // 普通函數---直接調用 10 function f1() { 11 console.log("putonghanshu"); 12 } 13 f1(); 14 // 構造函數---通過new來調用 15 function F1(){ 16 console.log("gouzaohanshu") 17 } 18 var f = new F1(); 19 20 // 對象的方法---對象.方法(); 21 function Person(){ 22 this.play = function(){ 23 console.log("Person is playing") 24 }; 25 } 26 var per = new Person(); 27 per.play(); 28 29 </script> 30 <body> 31 </body> 32 </html>