There are already built-in functions to check if string is a valid number in javascript. […]