title: undefined variables for push or concrat arrays
body: <p>Can't figure out how to put all variables of PROTOCOL in an new array with an loop function for N PROTOCOL's (same forms as Sequence 1). the problem is, that i earn in all cases different fails(see uncomment OUTPUTS in code) and all the inputs of the "dynamic" arrays are gone after i take a look at the console.log after the loop. its frustrationg as a beginner. thx for help</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>let NR_i = 0;
  let NR_i_end = 7;
  let PROTOCOL = new Array();
  let PROTOCOL_HTML = new Array();  
  let PROTOCOL_CSS = new Array();  
  let PROTOCOL_JS = new Array(); 
  let PROTOCOL_PHP = new Array();  
  let PROTOCOL_MySQL = new Array();
  let PROTOCOL_CindyJS = new Array();
  let PROTOCOL_C_Cpp = new Array(); 
  let allgemein = [];
  
  //-- Sequence 1 --//
  PROTOCOL = [{name:"HTML", index:[].sort()},
           {name:"CSS", index:[].sort()},
    {name:"JS", index:["document", "getElementById", "var",
    "message", "console", "log"].sort()},
    {name:"PHP", index:["echo"].sort()},
    {name:"MySQL", index:[].sort()},
    {name:"CindyJS", index:[].sort()},
    {name:"Python", index:[].sort()},
    {name:"C_Cpp", index:[].sort()}     
    ];
  while(NR_i &lt;= NR_i_end) {
    var nameX_2 = [];
    if (PROTOCOL[NR_i].index.length != 0) 
      nameX_2 = 'PROTOCOL_' + PROTOCOL[NR_i].name;
      // OUTPUT - OK: PROTOCOL_JS and so on.
          
      //nameX_2.push(PROTOCOL[NR_i].index);
      // OUTPUT: TypeError: nameX_2.push is not a function
         
      //window[nameX_2].push(PROTOCOL[NR_i].index);
      // OUTPUT: TypeError: Cannot read property 'push' of undefined
          
      //nameX_2 = nameX_2.concat(PROTOCOL[NR_i].index);
      // OUTPUT: PROTOCOL_JSconcat,console, ...
      // Why is PROTOCOL_JS also in? that disturb the hole array
  
      //nameX_2 = nameX_2.concat(window[PROTOCOL[NR_i].index]);
      // OUTPUT: PROTOCOL_JSundefined
  
      //nameX_2 = [...nameX_2, ...window[PROTOCOL[NR_i].index]];
      // OUTPUT: TypeError: window[PROTOCOL[NR_i].index] is not iterable
  
      nameX_2 = [...nameX_2, ...PROTOCOL[NR_i].index];
      // OUTPUT: ["P", "R", "O", "T", "O", "C", "O", "L", 
      //          "_", "J", "S", "concat", "console", and so on
      // Again. Why is PROTOCOL_JS also in? that disturb the hole array
         
      console.log("protocolname_3: ", nameX_2);
    }
    NR_i++;
  }
  console.log("PROTOCOL_HTML: ",PROTOCOL_HTML);
  console.log("PROTOCOL_CS: ",PROTOCOL_CSS);
  console.log("PROTOCOL_JS: ",PROTOCOL_JS);
  console.log("PROTOCOL_PHP: ",PROTOCOL_PHP);
  console.log("PROTOCOL_MySQL: ",PROTOCOL_MySQL);
  console.log("PROTOCOL_CindyJS: ",PROTOCOL_CindyJS);
  console.log("PROTOCOL_C_Cpp: ",PROTOCOL_C_Cpp);
  console.log("nameX_2: ",nameX_2);
  // OUTPUT: all empty =/
  //-- Sequence 2 --//
  // Same struct as Sequence 1, just with different name inputs
  //-- Sequence N --//
  // Same struct as Sequence 1, just with different name inputs</code></pre>
  </div>
  </div>
  </p>