This program uses a for loop and nested 'if..else if..else' statement that prompts the user to enter a number of 3 digits or more. The program then swaps the second and last digit of the inputted number, and outputs both the inputted number and converted number to the console and as an alert.
- Clone the repo and open with your preferred IDE (e.g. VSCode).
- In the IDE, open the swapping.html file and click the 'run' button, or click 'Go Live' if using VSCode. This should open your browser automatically to your localhost port with '/swapping.html' as the URL endpoint.
- Once the html file is loaded in your browser, a popup window will appear asking you to enter a number at least 3 digits long.
- One you have entered the number, another popup will appear with the swapped number.
I created this project myself as part of my Hyperiondev course: Immersive Full Stack Web and Software Engineer (Level 1, Task 7), using the following websites for reference.