Hacker News new | ask | show | jobs
by orange8 2249 days ago
There are two different concepts as I see it, please correct me if your definitions differ.

"stateful": A function that has state, i.e. can store data

"with effects": A function that modifies data outside its own scope

Normal JS functions (as opposed to arrow function) already do this:

function foo(){};

foo.state = bar;

Generator functions take it a step further, where the function remembers internal state between calls.