Inspiration
This project was inspired by the string reverse script challenge for day 2 of LHD: Build.
What it does
Type in any string you like, and see it reversed live — there's a "Copy" button if you want to use the reversed string elsewhere, too!
How I built it
A JS script constantly checks for user input, as well as detects changes in inputted text, then a for loop adds each character of the typed string to a string variable reserved for its reversed counterpart. The reversed version of the string is then displayed by adding it to the text content of a <p> tag.
I also used the Clipboard API to create a "Copy string" button. What it does is in its name: users can click the button to copy the reversed string. The JS script checks for the "existence" of a string, as well as any errors that may have occurred when writing to the clipboard (the Clipboard API isn't fully supported quite yet); a message will pop up, instructing the user to first type a string or alerting that their browser doesn't support the Clipboard API, respectively. If there are no errors, the message will inform the user that they have successfully copied the text.
Challenges I ran into
While this project is very simple, it was essentially my first time interacting with the clipboard through JavaScript. Thankfully this is quite well documented, so I was able to learn how to make use of the Clipboard API for text-copying purposes.
What I'm proud of/What I learned
I was able to review a bit more JavaScript and speedily create a simple mini-project, as well as learn one way of making a "copy" button.
What's next for String Reverser
Since the Clipboard API doesn't have full support in every browser, a fallback could be implemented using the deprecated (but for now, still well-supported) document.execCommand('copy') command.
Additional ways of manipulating the user-inputted string could also be added, or variants of the string reverse script could be written in other programming languages to challenge my skills in those languages.

Log in or sign up for Devpost to join the conversation.