The data the user is going to enter will be a string (as it could include spaces, and possibly even letters).
There are several ways to remove spaces from a string:
- Use split() and join() to split on spaces and join without them
- use indexOf() to find spaces, remove them using substring, and iterate until no more spaces
- iterate every character of the string, building a new string out of non-space characters
- use a regular expression
- use replace() (thanks @David Wallace - I completely overlooked the obvious one)