As I have said, what if the user types "stars" or "planets"?
var value = parseInt(number);
If you use parseInt() you ought to specify the radix. But better to use Number()
All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.