title: Is there a way to implement HTML hrefs into a JS array, and when called on opens the respective link?
body: <p>I have a JavaScript array and I wanted to put HTML links in that array. I don't know if there is a certain way to go about this. Also, if it's possible, when the user clicks the button and it selects the link, is there a way to make that link open up in a new tab (I know in HTML its target=_blank). I appreciate any help as always.</p>
  
  <p>JavaScript:</p>
  
  <pre><code>var i = Math.floor(Math.random() * 10) +1;
  function randomPageWithJS() {
  const arrayJS = [link1, link2, link3, link4];
  document.getElementById('randomPageWithJS').value = arrayJS[i];
  }
  randomPageWithJS();
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>&lt;form&gt;
        Random Song:&lt;input type="text" id="randomPageWithJS" name="randomPage"/&gt;
        &lt;input type="button" value="RandomPage" onclick="randomPageWithJS()" width="1000"/&gt;
      &lt;/form&gt;
  </code></pre>