Using ChatGPT to code a browser based trivia game

David Such
8 min readJun 6, 2023

ChatGPT is surprisingly good at coding simple websites. We had been reading about people generating browser based games using ChatGPT and decided to see if we could come up with the next Wordle.

Figure 1. ChatGPT pumping out the JavaScript

Our previous review of ChatGPT’s programming expertise was a bit of a mixed bag. Our conclusion was that ChatGPT was useful for code snippets, commenting, suggesting approaches, error message diagnosis and providing examples of common code with well documented solutions. It is not so good at generating code for large, complex, or niche applications.

Simple browser based games appear to be right in its wheelhouse. In our earlier article we used languages that we were familiar with (Python and C++). We have no experience with web development (JavaScript, HTML and CSS), so this time ChatGPT needed to do all the heavy lifting. And it did! All the code it produced (Figure 1), worked first time. The only area we have a small quibble with is that it didn’t always warn you if changes to the JavaScript also required changes to the HTML and/or CSS files.

--

--

David Such

Reefwing Software · Embedded Systems Engineer · iOS & AI Development · Robotics · Drones · Arduino · Raspberry Pi · Flight Control