title: Concatinating two variables to make a new variable which is assigned a number
body: <p>I have several variables that I want to be able to use that are numbers for an equation. But in order to get to those variables, I am having to string together two variables to get this number. The problem I have is I don't understand the syntax to use that variable as a number instead of the concatenated name.</p>
  <p>Here are the variables with their associated numbers:</p>
  <pre><code>var drygood = 0.9;
  var dryaverage = 0.8;
  var drybad = 0.7;
  var wetgood = 0.7;
  var wetaverage = 0.6;
  var wetbad = 0.5;
  var snowygood = 0.3;
  var snowyaverage = 0.3;
  var snowybad = 0.3;
  var icygood = 0.1;
  var icyaverage = 0.1;
  var icybad = 0.1;
  </code></pre>
  <p>The words are made from climate (dry, wet, snowy, icy) and tire condition (good, average, bad).</p>
  <p>I randomly pick a word from the first array and the second array and concatenate them.</p>
  <p>So, I end up with one of the words in the above variables.</p>
  <pre><code>const tires = [&quot;good&quot;, &quot;average&quot;, &quot;bad&quot;];
  const tireCondition = Math.floor(Math.random() * tires.length);
  console.log(tireCondition, tires[tireCondition]);
  
  const coldClimates = [&quot;dry&quot;, &quot;wet&quot;, &quot;icy&quot;, &quot;snowy&quot;];
  const randomTireCold = Math.floor(Math.random() * coldClimates.length);
  console.log(randomTireCold, coldClimates[randomTireCold]);
  </code></pre>
  <p>The console logs confirm I am getting the concatenation and that the string returned is correct. But then I need to put that into an equation:</p>
  <pre><code>let stoppingDistMapOne = ((+velocitySquared / (2 * coldClimates[randomTireCold] + tires[tireCondition] * 9.81)) + +reactionTimeDistance);
  </code></pre>
  <p>coldClimates[randomTireCold] + tires[tireCondition] = the variable name already given, but it doesn't convert that to the number. So, I am guessing I am missing some syntax. I get the correct variable name, but not the number associated with that variable.</p>
  <p>Any help greatly appreciated.</p>