The Code for REWIND.


The Code is structured in three functions.

getString()

The getString() function is responsible for retrieving the string the user provides in the input field. It will then pass the string to the reverseString() function and call the displayString() function, which are described below.


reverseString()

The reverseString() function takes one parameter which is the string to reverse. It splits the string into an array of its individual characters. This array is then reversed and joined to form a string once again. The final string is returned.


displayString()

The displayString() function takes one parameter which is the string to display. The string is added to the .innerHTML property of the <p> tag that holds the message. Finally the alert card is made visible.