title: taking variables from one function to use in another function
body: <p>i'm creating a game in javascript for college and i have a button to call a function but i need it to include variables from another function</p>
  
  <p>if i put the function inside the other function where the variables are the button doesn't call it</p>
  
  <p>is there a way of doing this or to get the variables that were created in the first function and use them in the second function</p>
  
  <p>it is a simple maths game where you get a random number a random sum and another random number
  (i.e. 5+7, 4*3, 2/6, etc,)</p>
  
  <p>so i've got a function to show the random number using</p>
  
  <pre><code>var ranNum1a=Math.floor(Math.random()*10);
  </code></pre>
  
  <p>i need the other function to check the users answer but i need to know what the random number was from the other function</p>