title: I want to add an value to an array, trying using splice, but it want work?
body: <p>Im having problem with getting splice to work for my /home.</p>
  <p>Im clearly doing something wrong but I cant figure out what, please 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>const logArray = [
    "|timestamp              |url           |userid|",
    "|2019-03-01 09:00:00UTC |/contact.html |12345 |",
    "|2019-03-01 09:00:00UTC |/contact.html |12346 |",
    "|2019-03-01 10:00:00UTC |/contact.html |12345 |",
    "|2019-03-01 10:30:00UTC |/home.html    |12347 |",
    "|2019-03-01 11:00:00UTC |/contact.html |12347 |",
    "|2019-03-02 11:00:00UTC |/contact.html |12348 |",
    "|2019-03-02 12:00:00UTC |/home.html    |12348 |",
    "|2019-03-03 13:00:00UTC |/home.html    |12349 |",
    ""
  ];
  
  let result = [];
  
  const urls = () =&gt; {
    const url = logArray.map((Objects, index, arr) =&gt; {
      return Objects.slice(25, 38);
    });
    console.log("url:", url);
    if (url) {
      const contact = url.find((a) =&gt; a.includes("contact"));
      result.push(contact);
      console.log(contact);
      //console.log(contact)
    }
    if (url) {
      const home = url.find((a) =&gt; a.includes("home"));
      result.splice(3, 0, home);
      console.log(home);
    }
  };
  urls();
  console.log(result);</code></pre>
  </div>
  </div>
  </p>
  <p>and I have counted the unique user ids on each url and no. of visits on each url.</p>
  <p>So I get this array back, no splice at all?!:</p>
  <pre><code>console.log(&quot;result:&quot;, result); //output [&quot;/contact.html&quot;, &quot;/home.html   &quot;, 5, 4, 1, 1]
  </code></pre>
  <p>this is what I would like it to look like:</p>
  <pre><code>// dream scenario: [&quot;/contact.html&quot;, 5, 4, &quot;/home.html&quot;, 1, 1]
  
  </code></pre>
  <p>When I take the splice function out of the code and try it in codepen it works fine....but not in the fully code</p>