I learned about generator functions in JS. They can be paused and resumed at any moment. There was an example of a continuously running function which reminded me about lazy evaluation in Haskell. The function only gives you a value when you ask for it.