learning about invocation patterns in javascript