JS listing from book JavaScript: Patterns (Stoyan Stefanov)