title: Unable to figure out the "undefined" in my logic
body: <p>I am creating a statement where i insert the values based on the input from drop-down. And i am able to create a statement. But when i merge the statement snippets, i get "undefined" in the beginning and in between. What and Why is this "undefined" , i am unable to determine. Please help.
  The coding is in angular2, but i believe it is simply a logic issue.</p>
  
  <p>Logic -
  code -</p>
  
  <p><strong>app.component.ts</strong></p>
  
  <pre><code>// For arranging a unit and number of commas.
        for (var i = 0; i &lt; this.subNodeItemLength; i++) {
  
          this.unit[i] = ", ( " + this.letter[i] + ":" + this.subnodeSelectItemtext[i] + " ) - [" + this.letter[i + 1] + " ] - ( " +
            this.letter[i + 2] + ") ";
  
          this.units.push(this.unit[i]);
          console.log("units = ", this.units);
          this.commas.push(this.comma);
          console.log("commas", this.commas);
          console.log("comma =", this.comma);
        }
  
        // Complete Statement
  
        for (var i = 0; i &lt; this.subNodeItemLength; i++) {
  
          console.log("before statement logic = ", this.statement)
  
  
          this.statement[i] += (this.units[i] + this.commas[i - 1]);
  
  
          console.log("After logic, statement =", this.statement[i]);
        }
        console.log("final statement =", this.statement);
  
        // After RETURN 
  
        for (var i = 0; i &lt; this.subNodeItemLength; i++) {
  
          this.afterReturn += this.letter[i] + this.commas[i - 1];
        }
  
        // Cypher Query
  
        this.cypherQuery = "MATCH (xab:" + this.rootItemText + " ) OPTIONAL MATCH (xab: " + this.rootItemText + ")-[r1]-(p1)" +
          this.statement + "RETURN xab,r1,p1 ," + this.afterReturn;
  </code></pre>
  
  <p><strong>output -</strong></p>
  
  <pre><code>units =  [", ( a:SMS ) - [b ] - ( c) "]
  
  commas [","]
  
   comma = ,
  
  units =  (2) [", ( a:SMS ) - [b ] - ( c) ", ", ( b:Collection ) - [c ] 
  - ( d) "]
  
   commas (2) [",", ","]
  
  comma = ,
  
   units =  (3) [", ( a:SMS ) - [b ] - ( c) ", ", ( b:Collection ) - [c 
    ] - ( d) ", ", ( c:Payments ) - [d ] - ( e) "]
  
   commas (3) [",", ",", ","]
  
   comma = ,
  
   before statement logic =  []
  
   After logic, statement = undefined, ( a:SMS ) - [b ] - ( c) undefined
  
  
  
  before statement logic =  ["undefined, ( a:SMS ) - [b ] - ( c) undefined"]
  
  After logic, statement = undefined, ( b:Collection ) - [c ] - ( d) ,
  
  before statement logic =  (2) ["undefined, ( a:SMS ) - [b ] - ( c) undefined", "undefined, ( b:Collection ) - [c ] - ( d) ,"]
  
  After logic, statement = undefined, ( c:Payments ) - [d ] - ( e) ,
  
   final statement = (3) ["undefined, ( a:SMS ) - [b ] - ( c) undefined", "undefined, ( b:Collection ) - [c ] - ( d) ,", "undefined, ( c:Payments ) - [d ] - ( e) ,"]
  
  
  
   NeoVis {_config: {…}, _encrypted: "ENCRYPTION_OFF", _trust: "TRUST_ALL_CERTIFICATES", _driver: Driver, 
  
  _query: 
  "MATCH (xab:Century ) OPTIONAL MATCH (xab: Century)…- ( e) ,RETURN xab,r1,p1 ,undefinedaundefinedb,c,", …}
  
  
      neovis.js:36680 Error: Invalid input 'd': expected 'w/W' or 'i/I' (line 1, column 63 (offset: 62))
  
      "MATCH (xab:Century ) OPTIONAL MATCH (xab: Century)-[r1]-(p1)undefined, ( a:SMS ) - [b ] - ( c) undefined,undefined, ( b:Collection ) - [c ] - ( d) ,,undefined, ( c:Payments ) - [d ] - ( e) ,RETURN xab,r1,p1 ,undefinedaundefinedb,c,"
  </code></pre>