title: Append array value to string
body: <p>How can an array value (could be any number less than 20K) be appended to a string?
  I'm trying to imitate :</p>
  
  <blockquote>
    <p>if (form1.EActQ2<strong>0</strong> === undefined) { Q2B<strong>0</strong> = 0; }
        else (Q2B<strong>0</strong> = document.form1.EActQ2<strong>0</strong>.value);</p>
  </blockquote>
  
  <pre><code>var und = x &lt; 20000;
  var less1 = form1.EActQ1.und.toString();
  var less2 = form1.EActQ2.und.toString();
  var less3 = form1.EActQ3.und.toString();
  var less4 = form1.EActQ4.und.toString();
  
  if (less1 === undefined) { Q1B.und.toString() = 0; }
  else (Q1B.und.toString() = document.less1.value); /// is now a value to get added in  an equation
  
  if (less2 === undefined) { Q2B.und.toString() = 0; }
  else (Q2B.und.toString() = document.less2.value);
  
  if (less3 === undefined) { Q3B.und.toString() = 0; }
  else (Q3B.und.toString() = document.less3.value);
  
  if (less4 === undefined) { Q4B.und.toString() = 0; }
  else (Q4B.und.toString() = document.less4.value);
  </code></pre>
  
  <p><strong><em>/// Revised Code Below</em></strong></p>
  
  <pre><code>arr = [];
  var und = 0; // some number below 2000
  var less = form1["EActQ1" + und];
  
  if (less1 === undefined) {
    arr[und] = 0;
  } else {
    arr[und] = document["less1" + und].value;
  }
  
  if (less2 === undefined) {
    arr[und] = 0;
  } else {
    arr[und] = document["less2" + und].value;
  }
  
  if (less3 === undefined) {
    arr[und] = 0;
  } else {
    arr[und] = document["less3" + und].value;
  }
  
  if (less1 === undefined) {
    arr[und] = 0;
  } else {
    arr[und] = document["less1" + und].value;
  }
  
  
  
  add =  (["Q1B"+ und] * 1)+(["Q2B"+ und] * 1)+(["Q3B"+ und] * 1)+(["Q4B"+ und] * 1);
  </code></pre>
  
  <p>Returns NaN. I'm defining cells based on their values and trying to add them up.</p>