function() { return count++; } is running because it is a function declaration. It is running and result of this running a function has been created and sent as a parameter to return command. "return count++;" this part is not running because the function has not been called yet.
We need to put 'null' to end of linked list. otherwise wen we want to get last item in the linked list, it will be undefined. And this situation inconsistent with object literal definition of linked list above.
There has to be a scary CPU-intensive task here, otherwise the example wouldn't make sense. Hence the suppression of "can";
I have also removed "actually" because in this context it would be interpreted as "to your surprise", which is not the case here
"Now when the call looks for `count` variable, it first searches its own Lexical Environment (empty), then the Lexical Environment of the outer `makeCounter()` call, where finds it."
to
"Now when the call looks for `count` variable, it first searches its own Lexical Environment (empty), then the Lexical Environment of the outer `makeCounter()` call, where it finds it."
As per issue comment thread #1282:
Clarifying "current code" for zero delay setInterval.
Plus minor edit of ordering of terms for greater consistency.
Plus minor grammatical fixes.
Wording was ungrammatical and hard to understand. I made my best guess as to what you want to say. However, it is not clear from the description or the examples whether the debounce wrapper should inhibit calls attempted ms milliseconds after the last call that wasn't ignored, or ms milliseconds after the last call that was attempted, even if it was ignored. I would think it would be the former, but the example could go either way. If the f(4) example used 1000 or 1001 ms and still runs, that would clear it up. If it has to be 1100 like it is, that would suggest that it's the second scenario above. In my propsed change I preserved the ambiguity.
Qualify that while cachingDecorator() will now work with any number of arguments, the hash() function given will not. Or, perhaps better, could just change the hash function to something like:
function hash(args) {
return [...args].join();
}