Lab 11 - JavaScript Events & Forms

Challenge

Our goal here was to mimic what we did in lab 7 and turn it into an input box. We also used jQuery and included an anagram sorter.

Problems

I think the main problem for me was just not knowing what to start with. Thanks to Nicole, I figured out that we were supposed to reuse the functions from lab 7 to create another sorting system. I wanted to combine the functions I created into one singular function and used ChatGPT to easily do that. To be more specific, I inserted my code into the prompt for ChatGPT using ``` and asked the A.I. to convert it. Surprisingly, the resulting code worked miraculously. Furthermore, I struggled a bit with how to get started on the anagram sorter. I took a look at Nicole's code and realized that it used the Fisher-Yates shuffle method to shuffle the name into random order. Afterwards, I would essentially do what I did in my other sorter to space and capitalize the name and was able to create crisp-clean functions.

Other things I struggled with in this assignment was getting the input box to print only one output and if there was no input, not print at all. I tried using a for loop so that the button considers whether or not there are any strings in the input. If there are no strings, it would ask you to input a name in the console log. For printing only one output, I once again consulted ChatGPT and found that I could initalize a checker to see if content has already been appended. I fixed that into the code I already made for the button and tested it out. I was very happy to see it working as intended.

Results

For this lab, I created two input fields that did different effects.

Alphabetical Name Sorter:

Anagram Name Sorter: