Add JavaScript implementation for chapter02