added closure idiom from the book JavaScript: The Good Parts