I was able to use GPT4 to write a small, self-contained JavaScript function and it worked okay. But writing out the function is painfully slow, particularly if you want to iterate. Which you’ll need to do because sometimes it introduces bugs. You can tell it to fix them and it can, but then you have to wait.