title: How do I concatenate several different variables to create a URL
body: <p>I'm trying to use a for loop to generate a bunch of different urls to use in my table via Javascript.</p>
  
  <p>The final url that i want is: <a href="http://www.enviroptics.com/ecommerce/environmentally-sealed-thermocouple-nb4-caxl-14u-12-aag.html" rel="nofollow noreferrer">http://www.enviroptics.com/ecommerce/environmentally-sealed-thermocouple-nb4-caxl-14u-12-aag.html</a></p>
  
  <p>The url is basically broken down into 4 sections:</p>
  
  <ol>
  <li>prefix: '<a href="http://www.enviroptics.com/ecommerce/" rel="nofollow noreferrer">http://www.enviroptics.com/ecommerce/</a>'</li>
  <li>product name: 'environmentally-sealed-thermocouple-'</li>
  <li>product number: 'nb4-caxl-14u-12-aag'</li>
  <li>suffix: '.html'</li>
  </ol>
  
  <p>The prefix and suffix wont be changing. The product name will also stay the same within the javascript but I want it as a separate variable because I plan on making a bunch of javascripts, 1 for each different product name. The product number WILL change for each different row and link in my table.</p>
  
  <p>This is what I have so far:</p>
  
  <pre><code>var eo_url_1 = 'http://www.enviroptics.com/ecommerce/';
  var eo_url_ext = "environmentally-sealed-thermocouple-"
  var eo_url_2 = '.html';
  </code></pre>
  
  <p>I also have a for loop that is generating my part number and when i use console log I get this:</p>
  
  <pre><code>console.log(eopartnum[i]); //yields the following part number results
  //NB4-CAXL-14U-12-AAG
  //NB4-CAXL-14U-12-BAG
  //NB4-CAXL-14U-12-CAG
  //(24 more similar results)
  </code></pre>
  
  <p>So for example eopartnum[0] = NB4-CAXL-14U-12-AAG. I tried to use this to concatenate everything:</p>
  
  <pre><code>window.navtoprod = function() {
    window.document.location = eo_url_1.concat(eo_url_ext,eopartnum[i],eo_url_2);
  }
  </code></pre>
  
  <p>but it seems to be giving me an error with the part number either by trying to direct me to '<a href="http://www.enviroptics.com/ecommerce/environmentally-sealed-thermocouple-undefined" rel="nofollow noreferrer">http://www.enviroptics.com/ecommerce/environmentally-sealed-thermocouple-undefined</a>' or '<a href="http://www.enviroptics.com/ecommerce/environmentally-sealed-thermocouple-[object%20text]" rel="nofollow noreferrer">http://www.enviroptics.com/ecommerce/environmentally-sealed-thermocouple-[object%20text]</a>'</p>
  
  <p>Here is the w3 that I've been working in: <a href="http://www.w3schools.com/code/tryit.asp?filename=F0VL5U0MKS2H" rel="nofollow noreferrer">http://www.w3schools.com/code/tryit.asp?filename=F0VL5U0MKS2H</a></p>