chapter6 finish and test events in the js file