I am trying to return a value after a function has been called n times. Here is what I still have:
function spyOn(fn) { //takes in function as argument //returns function that can be called and behaves like argument var count = 0; var inner = function(){ count++; } inner.callCount = function(){return count}; }
And here is how I test it:
for (var i = 0; i < 99; i++) { spyOn(); }
I feel that this is a simple problem that I should be able to just google, but I could not find a solution. Thanks!
source share