Little JavaScript (TypeScript) Examples

I don't know what title to give this yet. Some provisional ideas are:

Here we have a nice little closure that returns a function that accesses a private saved state.

I love how concise the execution of the returned functions are. These would have to be method invocations in a "classical" OOP language and simply would be as neat.

Just in case you were wondering what all this messing around with sines and periodicity are all about, this is a prototype for a generator of the classic British GPO dial tone for an antique phone emulation that I seem to have become obsessed with.


More stuff to read