<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: inspecto0</title>
    <description>The latest articles on DEV Community by inspecto0 (@inspecto0).</description>
    <link>https://dev.to/inspecto0</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F441408%2Fd3200f63-83fd-4b96-9f90-c0c50dd18949.png</url>
      <title>DEV Community: inspecto0</title>
      <link>https://dev.to/inspecto0</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/inspecto0"/>
    <language>en</language>
    <item>
      <title>Could some on explain something to me</title>
      <dc:creator>inspecto0</dc:creator>
      <pubDate>Mon, 16 Nov 2020 07:59:28 +0000</pubDate>
      <link>https://dev.to/inspecto0/could-some-on-explain-something-to-me-4g2f</link>
      <guid>https://dev.to/inspecto0/could-some-on-explain-something-to-me-4g2f</guid>
      <description>&lt;p&gt;Hello, I am new to this and still learning the new stuff :)&lt;/p&gt;

&lt;p&gt;I have a question about mine javascript and i hope this is the right area to get a answer :)&lt;/p&gt;

&lt;p&gt;So i made a code that every 2e of 3e word change from color(its a bit random). I used 'getElementById' but i know so far mine knowledge goes that it only works for 1 id. And i want to use the code on more places with diffrent "id's" but don't want to duplicate mine code.&lt;/p&gt;

&lt;p&gt;Could some on explain to me what to do? Or is there documentation i could read with some explanation how to make maybe a function with the code? I hope some on could explain how to clean this up ;)&lt;/p&gt;

&lt;p&gt;Here is mine code:&lt;/p&gt;

&lt;p&gt;var paragrapgh = document.getElementById("ads_colordtitel");&lt;br&gt;
var words = paragrapgh.innerText.split(" "); &lt;br&gt;
var colors = ["#0B88EE", "#FFFFFF"];&lt;br&gt;
var spans = [];&lt;/p&gt;

&lt;p&gt;for(var x = 0; x &amp;lt; words.length; x++){&lt;br&gt;
    var color = colors[Math.floor(Math.random()*colors.length)] &lt;br&gt;
    var span = "&lt;span&gt;" + words[x] + "&lt;/span&gt;"&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;spans.push(span);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;paragrapgh.innerHTML = spans.join(" ");&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>help</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
