11_对象类型.html 875 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>Document</title>
  7. </head>
  8. <body>
  9. <script>
  10. var person = {
  11. name: "小朋",
  12. age: 18,
  13. sex: "男",
  14. talk:function(){
  15. // console.log(person.name);
  16. // 在对象当中实用this 指向当前对象
  17. console.log(this.name);
  18. }
  19. }
  20. person.school = "黑大";
  21. console.log(person);
  22. // person.talk();
  23. // var person2 = {
  24. // name: "小红",
  25. // age: 18,
  26. // sex: "女"
  27. // }
  28. // console.log(person.name);
  29. // var arr = [person, person2];
  30. // person.age = 20;
  31. // console.log(person);
  32. </script>
  33. </body>
  34. </html>