I'm trying to return a value after a function has been invoked n number of times. Here's what I have so far:
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 this is how I'm testing it:
for (var i = 0; i < 99; i++) {
spyOn();
}
I feel like this is a simple problem that I should be able to simply google, but I haven't been able to find a solution. Thanks!