JS design pattern examples following Addy Osmani's book