Filter an Array by Keyboard Rows
I subscribe to Cassidoo’s newsletter, and in it, she offers up a coding challenge. Lately, I’ve been using it as a way to experiment with ChatGPT. Just to be sure, I do not submit these for credit. It’s just a way to learn how to approach it both from the code and the prompting.
The first attempt was a miss, but it helps me learn how to be more direct about my prompts. I used:
I won’t output the full thing, but it led with, “Here’s an implementation of the function you’re asking for. In this version, you’ll specify the keyboard row as a string of characters, and it will filter the array accordingly.”, along with a walkthrough of the code for that.
I followed up with, “Refactor this to allow for the keyboard type to be an argument instead of row”, which worked. In the future, I know that I should specify the arguments.
Ooh, before publishing this I found out I have access to shared links, so you can see the actual chat.