GoF patterns in JavaScript