Dear AI, please write some code for me

[Written by the human] No-code tools are great. Sometimes it's still handy to have real code written and language models like ChatGPT and Bard (Google) can do that - at least if your code is simple like the one I use for the tools on this website. Here are some step-by-step instructions on how to tell ChatGPT what code to write.

We're using the example of a distance unit conversion tool that can be embedded into a website using html and some javascript.

[written by the human] Just as in interactions with real code-writing people, it's all about how clear you make the instructions. I admit that this is a very simple piece of code, it's a good example to show how ChatGPT can help write it. Go, and give it a go. The code might not be the most efficient, but it works most of the time/often.

Sometimes the answer is too long, so ChatGPT needs to be nudged to give the whole answer. Figuring out if I've been given the whole code is the only "programming skill" I've used in this project.

[written by the human] Don't expect the code to be perfect. Sometimes ChatGPT introduces random bugs in between iterations.
Especially for longer answers, it sometimes seems to trip over its own virtual feet and stops working.