Hi, welcome to the ranch! And the HTML & JavaScript forum!
If you're not familiar with the ranch, you'll find we give you hints and invite you to do all the real work. We try not to just do homework, or real work, for folks. So ... I could imagine doing this two ways.
One: make a
string from your user input, work your way through it one character at a time and add each character to a new string. Google for JavaScript string functions and see what you find.
Two: find a JavaScript math function that will give you just the "ones column" of your number. Make that your new result. Divide the original number by 10 to remove that "ones" value and repeat. I left out a critical bit of output processing but you'll find it quickly enough.
The ranch works really well when you post some code that almost works, so take a shot at either or both of those and show us what you make!