title: problems to figure out how to set dynamic variables to functions like push, indexOf
body: <p>how can i set dynamic variables on an function? if you try to run the snipped version you can see, that the output is just an point. i also tried to take a look inside the code, and look at that, the return a value is undefined. i tried also with window[<code>${which_section}</code>], but i am a beginner and don't know how i could handle that. thx</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>var Nr22_objectarray_1 = [ {name: "fruit", species: "apple"},
                             {name: "miau", species: "cat"},
                         {name: "omeprazol", species: "medicine"},
                           ];
  var Nr22_objectarray_2 = [ {name: "fruit", species: "orange"},
                             {name: "miauzi", species: "cat"},
                             {name: "ezomeprazol", species: "medicine"},
                           ];
  var Nr22_objectarray_3 = [ {name: "fruit", species: "banana"},
                             {name: "miau", species: "cat"},
                             {name: "nivea", species: "cream"},
                           ];
  function Nr22_reduceDuplicatesOnObjectArrays (which_array, which_section) {
    let tester = which_array.reduce(function (a, b){
      if ( a.indexOf(b.which_section) &lt; 0 ) {
         // which_section = name
         a.push(b.which_section);
       }
       //a = undefined
       return a;
     }, []);
     tester.sort();
     return tester.join(", ") + ".";
  }
  let Nr22_array_new = [];
  Nr22_array_new = Nr22_objectarray_1.concat(Nr22_objectarray_2, 
  Nr22_objectarray_3);
  let Nr22_uniq = Nr22_reduceDuplicatesOnObjectArrays(Nr22_array_new, "name");
  document.write(Nr22_uniq);</code></pre>
  </div>
  </div>
  </p>