3.html 646 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>Document</title>
  8. </head>
  9. <body>
  10. <script>
  11. function Foo() {
  12. Foo.a = function () {
  13. console.log(1)
  14. }
  15. this.a = function () {
  16. console.log(2)
  17. }
  18. }
  19. Foo.prototype.a = function () {
  20. console.log(3)
  21. }
  22. Foo.a = function () {
  23. console.log(4)
  24. }
  25. Foo.a();
  26. console.log(Foo)
  27. let obj = new Foo();
  28. console.log(obj)
  29. obj.a();
  30. Foo.a();
  31. </script>
  32. </body>
  33. </html>