Two helper functions are used above, one of which is moveToHead
. This simply removes the node and re-adds it to the front, moving it ahead and letting us know it was the most recently used key.

1moveToHead(node) {
2 this.removeNode(node);
3 this.addNode(node);
4};