title: Jasmine Create Spy on Native JS Function on Global Window Object
body: <p>I am writing a test to see if <code>Array.prototype.map</code> was called.  I thought this would work since Array.prototype.map is located on the global window object:</p>
  
  <pre><code>    it("does not use Array.prototype.map", function(){
  
          spyOn(window, "Array.prototype.map")
          fn([2,2,3]);
          expect(Array.prototype.map.calls.count()).toEqual(0);
      });
  </code></pre>
  
  <p>I receive the error <code>Array.prototype.map does not exist</code>.  When I create my own custom global functions, this method works fine.  <a href="https://stackoverflow.com/questions/9510148/using-jasmine-to-spy-on-a-function-without-an-object">Based on this other post</a> It appears any global functions can be spied on using the syntax I am using above.  If I create my own functions, this syntax works.  Any ideas on why <code>Array.prototype.map</code> is returning undefined?</p>