Please put the code inside a code block with JavaScript syntax highlighting. Furthermore, please implement the optimizations you proposed. Off-topic but in a race between a cow and a donkey who would win? Suggest some ways how we could get the opposite outcome. Thanks :)