I'm trying to create a game that tells you how hot or cold you are compared to a random number. The the user clicks a button I want the `checkNumber` method to run. How would I go about this? Feel free to let me know all the things wrong with this code as I'm trying to learn.

So far i have tried in the html: 

```
<button type="submit" id="userGuess" onclick="hotcold().checkNumber()"></button>

```

In JS:

```
function hotcold(){
    var realNumber = 0;
    var newGame = function(){
        realNumber = Math.floor(Math.random() * 100)+1
        return realNumber
    }

    var checkNumber = function (){
         var userinput = parseInt(document.getElementById("userGuess").value);
         var message ;

         if ( userinput == realNumber){ message = " Good Job you did it"}
         else if (Math.abs(userinput - realNumber) > 30){ var message = "You're colder than cold "}
         else if (Math.abs(userinput - realNumber) <= 30 && Math.abs(userinput - realNumber) > 10 ){  message = " You're getting closer"}
         else if (Math.abs(userinput - realNumber) <= 10 && Math.abs(userinput - realNumber) > 2 ){ message = " You're hot, now im scared"}
         else if (Math.abs(userinput - realNumber) <= 2){ message = " If you don't get this by next turn, something wrong with you"}
         else { message = " skjdksjhdsk "}

         alert(realNumber);
         alert(message);
   }

   return realNumber;
}

```