title: How to change background-color of a paragraph in Javascript
body: <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>let n = 5;
  let m = 5;
  for(let j=0; j&lt;m; j++){
  for(let i=0; i&lt;n; i++){
  let boite = document.createElement("p");
  boite.innerHTML = i+1;
    
  document.querySelector("body").appendChild(boite);
   
  }
   
  document.write("&lt;br&gt;");
  }</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>body{
    margin: 20px;
    background-color: white;
  }
  p{
    background-color: black;
    color: white;
    padding: 20px;
    width: 30px;
    border: 2px solid white;
    display: inline-block;
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>I'm trying to change the <code>background-color</code> of a paragraph in yellow when the number is even (so, in <strong>javascript</strong>).</p>
  
  <p>I believe i have to write a condition with as a result something like</p>
  
  <pre><code>document.body.style.backgroundColor = "yellow";
  </code></pre>
  
  <p>but i don't know how to select the paragraph as i don't want the <code>backgroundColor</code> of the <code>body</code> to change</p>