冰冰点灯
照亮我的家门
 1 <!DOCTYPE html>
 2 <html>
 3 <head lang="en">
 4     <meta charset="UTF-8">
 5     <title></title>
 6 </head>
 7 <body>
 8 <script>
 9     //生活中。一类事物和对象的区别。(对象是指具有唯一性的事物)
10     //游戏中。有特指的事物是对象。
11     //程序中。
12 
13     var hero = new Object();
14     //自定义属性--状态
15     hero.money = 10000;
16     hero.level = 6;
17 
18     //方法---行为。
19     hero.attack = function () {
20         console.log("攻击了水晶!");
21     }
22 
23     console.log(hero);
24     console.log(hero.money);
25     console.log(hero.level);
26     hero.attack();
27 
28     //属性和方法:状态(名词)和行为(动词)。
29 
30 </script>
31 </body>
32 </html>

 

posted on 2019-01-14 15:28  冰冰点灯  阅读(373)  评论(0)    收藏  举报