title: Javascript, replace first word in sentence in class
body: <p>I would like to assist on how replace the first name in the name class with Marty. I would like to only use Javascript not jQuery.</p>
  
  <p>So this should result in " Marty Clock " instead.</p>
  
  <pre><code>&lt;span class="name"&gt;Brad Clock&lt;/span&gt;
  </code></pre>
  
  <p>This is what i've got right now.
  <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 article = document.querySelector('article');
  const name = article.querySelectorAll('.name');
  
  
  for (var i = 0; i &lt; name.length; i++) {
   const text = name[i].textContent.split(" ").replace([0], ' ').join("Marty")
  
   console.log(text);
  
  
  
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;article&gt;
     
     &lt;p&gt;Does your mom know about tomorrow night? Good morning, Mom. Oh, &lt;span class="name"&gt;Marty&lt;/span&gt;, I almost forgot, &lt;span class="name"&gt;Jennifer Parker&lt;/span&gt; called. He's alright. Hey c'mon, I had to change, you think I'm going back in that zoot suit? The &lt;a href="https://giphy.com/gifs/film-back-to-the-future-anniversary2015-Y1aL1fxTEbhQs" art="Spooky young man"&gt;old man&lt;/a&gt; really came through it worked. &lt;a href="https://giphy.com/gifs/FrVlu71LVoVXy" alt="I guess you guys aren't ready for that yet"&gt;I have to tell you about the future&lt;/a&gt;.&lt;/p&gt;
     
     &lt;p&gt;He's absolutely right, &lt;span class="name"&gt;Marty&lt;/span&gt;. the last thing you need is headaches. Well, I guess that's everything. Please note that &lt;span class="name"&gt;Einstein's&lt;/span&gt; clock is in complete synchronization with my control watch. Good evening, I'm Doctor &lt;span class="name"&gt;Emmet Brown&lt;/span&gt;, I'm standing here on the parking lot of- What did you sleep in your clothes again last night.&lt;/p&gt;
     &lt;p&gt;Precisely. &lt;span class="name"&gt;George&lt;/span&gt;,  Hey beat it, spook, this don't concern you. &lt;a href="https://giphy.com/gifs/back-to-the-future-behind-scenes-CdAh3Sh0Mvtdu" alt="I'm flying!"&gt;Bet your ass it works.&lt;/a&gt; Here you go, lady. There's a quarter.&lt;/p&gt;
    &lt;/article&gt;</code></pre>
  </div>
  </div>
  </p>