title: How to replace words in a paragraph after a specified interval? with js
body: <p>Say I have a paragraph like this; <code>&lt;p class="some-text"&gt;This is just a random paragraph for example use. This is just a random paragraph for example use. This is just a random paragraph for example use. This is just a random paragraph for example use. This is just a random paragraph for example use.&lt;/p&gt;</code></p>
  
  <p>And I want to replace all "paragraph" with "text" 
  and I know that one can manipulate <em>strings</em> using <code>.replace(" paragraph", " text")</code> , but this is a whole paragraph. I also want the text to change with a delay of 5 seconds but what I get in return for the code below is <code>textToChange.replace is not a function</code>. How can I go about this with a whole paragraph? </p>
  
  <pre><code>function replaceWords() {
    const toChange = document.querySelector("some-text");
  
    const fixedWords = toChange
      .replace(" paragraph", " text")
  
  
    toChange.innerHTML = fixedWords;
  }
  setTimeout(replaceWords, 5000); 
  </code></pre>