title: how to load data using a javascript
body: <p>I have almost zero experience with Javascript , I need to use this Javascript in my php script .</p>
  
  <pre><code>&lt;script&gt;
  
  let arr = ["alfa", "beta", "charlie"]
  
  const updateResult = query =&gt; {
      let resultList = document.querySelector(".result");
      resultList.innerHTML = "";
  
      arr.map(algo =&gt;{
          query.split(" ").map(word =&gt;{
              if(algo.toLowerCase().indexOf(word.toLowerCase()) != -1){
                  resultList.innerHTML += `&lt;li class="list-group-item"&gt;${algo}&lt;/li&gt;`;
              }
          })
      })
  }
  
  updateResult("")
  &lt;/script&gt;
  </code></pre>
  
  <p>This script load the data using </p>
  
  <pre><code>let arr =
  </code></pre>
  
  <p>However suppose I have all the data specified there in a file in this format</p>
  
  <pre><code>c:/data/mydata.txt
  </code></pre>
  
  <p>and the data.txt contains data in this form (one data per row)</p>
  
  <pre><code>alfa
  bravo 
  charlie
  </code></pre>
  
  <p>Now how should I change the javascript above to load the data from     c:/data/mydata.txt and not using </p>
  
  <pre><code>let arr = ["alfa", "beta", "charlie"] 
  </code></pre>
  
  <p>?</p>
  
  <p>Thank you</p>