标签:on() new 构造函数 person color type strong charset rom
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>
标签:on() new 构造函数 person color type strong charset rom
原文地址:https://www.cnblogs.com/sylys/p/11579052.html