title: Trouble with looping over specific elements in nested Handlebars imported arrays
body: <pre><code>&lt;div class="sub_container"&gt;
  &lt;div class="logo-col"&gt; &lt;/div&gt;
  &lt;h2&gt;Welcome to {{title}}&lt;/h2&gt;
  &lt;script&gt;
  
      function showDiv() {
          var Displayobj = "";
          var Finalobj = "";
              for (var i = 0; i &lt; "{{projects.length}}"; i++) {
              Displayobj="{{projects.[i].[0]}}"+"'s current value is "+"{{projects.[i].[2]}}";
              Finalobj = Finalobj + "  |||  "+Displayobj;
              }
          document.getElementById('contentdiv').innerHTML = Finalobj;
          document.getElementById('contentdiv').style.display = "block";
  
  }
      &lt;/script&gt;
  
      &lt;input type="button" value="Value per Item" id="MyButton" onclick="showDiv()" /&gt; 
      &lt;button type="button"&gt;Value per Center&lt;/button&gt;&lt;button type="button"&gt;Amount of projects&lt;/button&gt;&lt;button type="button"&gt;Potential of projects&lt;/button&gt;
      &lt;div id = "contentdiv" style = "display:none;" class="sub_cnt_col" &gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>What I am trying to do is to specify what elements of the handlebar array  </p>
  
  <pre><code> {{projects}}
  </code></pre>
  
  <p>are displayed based on which button I click. For now I have only completed one button, but       "<code>{{projects.[i].[0]}}</code>"<br>
  returns nothing. On the web page I see:</p>
  
  <pre><code>||| 's current value is ||| 's current value is ||| 's current value is
  .  
  </code></pre>
  
  <p>But If I enter a number such as 0 for "i" it works perfectly fine, but I need it to iterate over all the instances.<br>
  projects contains an array like this ---->   </p>
  
  <pre><code>projects=[[Computer,info,50],[Desk, info, 10],[Plane, info, 450]]  
  </code></pre>
  
  <p><strong>EDIT:</strong> {{projects[i][0]}} does not work ---> it simply downloads an empty TextEdit file    </p>
  
  <p><strong>EDIT:</strong> I found this as well ---><br>
      <code>&lt;ul class="people_list"&gt;
        {{#each projects}}
          &lt;li&gt;{{this}}&lt;/li&gt;
        {{/each}}
      &lt;/ul&gt;</code><br>
  but the problem is that it does not display specific elements. AKA: projects should only display the 1st and 3rd elements and I do not know how to specify with this handlebars helper.  </p>
  
  <p><strong>EDIT:</strong> More strange things: if I change it to <code>{{projects[i][0]}}</code> in the console on the website it says <strong>Failed to load resource: Frame load interrupted</strong> even though I am not loading anything.  </p>
  
  <p><strong>EDIT:</strong> When I do <code>{{project[0][0]}}</code> and hard code it without the for loop it gets everything our correctly, so it must be something to do with the for loop specifically rather than not being able to access the array.  </p>
  
  <p><strong>EDIT:</strong> I've figured it out I made another variable outside of the for loop and called it <code>i</code> and I commented out the for loop and it still didn't work which means that the problem is in the array for some reason not being able to use a variable as its index. <strong>Still no fix though</strong>  </p>
  
  <p><strong>EDIT:</strong> My issue may have something to do with a lack of template since I never created one and to be honest don't necessarily know how.  </p>
  
  <p><strong>EDIT:</strong> My problem may be that I am attempting to iterate through it using javascript instead of HTML like the person in chiliNUT's example uses. however I do not know how to specify only 1 item with just HTML.  </p>
  
  <p><strong>EDIT:</strong>  </p>
  
  <pre><code>   var indexController = {
      index:function(req, res){
          var data = {
              title: "whatever"
          };
          var exphbs  = require('express-handlebars');  
  var hb = require('handlebars');
      // Creates the access token and uses the smartsheetSDK
      // specifies which sheet to go into
      var options = {
          id: 
      };
      var http = require('http');
      var rowIds = [];
      var dupcities = [];
      var cities = [];
      var projects = [];
      var finrow=0;
      var moneyDone = 0;
      var sheetRowlength=0;
      var ProjectsSortedintoCity=[];
      var moneymade=0;
      var ProjperCit = 0;
      // Gets the specific row
      /* jshint loopfunc:true */
      smartsheet.sheets.getSheet(options)
          .then(function (data0) {
              //gets the entire sheet, but only the rowIds are used
              for (var i = 0; i &lt;= data0.rows.length-1;i++) {
                  rowIds.push(data0.rows[i].id);
                  //pushes/prints the row ids
                  sheetRowlength =(data0.rows.length);
                  options= {sheetId: 
                            rowId: data0.rows[i].id};
                            //sets a new options for the rows
                      //gets the row
  
                  smartsheet.sheets.getRow(options)
                  .then(function (data1) {
                       projects.push([]);
                          for( var b = 0; b &lt; data1.cells.length; b++){
                          projects[finrow].push(data1.cells[b].value);
                      //prints out all the values of the row
  
                      }
                      dupcities.push(projects[finrow][4]);
                      finrow++;
                      if(projects.length===sheetRowlength){
                          var cities = dupcities.slice() // slice makes copy of array before sorting it
                           .sort(function(a,b){
                                  return a &gt; b;
                                })
                                .reduce(function(a,b){
                                  if (a.slice(-1)[0] !== b){ a.push(b);}// slice(-1)[0] means last item in array without removing it
                                  return a;
                                },[]);
                              for (var z = 0; z &lt;cities.length; z++) {
                                  ProjectsSortedintoCity.push([]);
                                  ProjectsSortedintoCity[moneyDone].push(cities[z]);
                                  for (var x= 0; x &lt;projects.length; x++) {
                                      if(projects[x][4]===ProjectsSortedintoCity[moneyDone][0]){
                                      ProjperCit++;
                                       moneymade=moneymade+projects[x][40]+projects[x][41]+projects[x][42]+projects[x][43];
                                  }
                                  }
                                  ProjectsSortedintoCity[moneyDone].push(moneymade);
                                  ProjectsSortedintoCity[moneyDone].push(ProjperCit);
                                  moneyDone++;
                                  moneymade=0;
                                  ProjperCit=0;
  
                              }
  
                          data.projects=ProjectsSortedintoCity;
                          data.cities=cities;
                          system.loadView(res,'index', data);
  
                      }
  
  
              })
              .catch(function (error){
                      console.log(error);
                      data.error=true;
                      system.loadView(res,'index', data);
                  });
          }
              console.log("HIIIIELO");
  
          })
          .catch(function (error) {
              console.log(error);
              data.error=true;
              system.loadView(res,'index', data);
          });
  
  
      // load index view from views, with passed data
  }
  };
  
  // add controller functions to exports
  module.exports = indexController;
  </code></pre>