一个有趣的js面试题目

<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Document</title>
  <script type="text/javascript">
  function a() {
    b = function() {
      alert(1);
    };
    return this;
  }
  a.b = function() {
    alert(2);
  }
  a.prototype.b = function() {
    alert(3);
  }
  var b = function() {
    alert(4);
  }

  function b() {
    alert(5);
  }
  a.b();  
  b();  
  a().b();  
  b();  
  new a.b();  
  new a().b();  
  new new a().b();  
  </script>
</head>

<body>
  <div>
  </div>
</body>

</html>
原文地址:https://www.cnblogs.com/happen-/p/6431932.html