Implementations of some simple data structure in JavaScript