A JavaScript version of memory