title: get HTML element style with Javascript
body: <p>I am trying to retrieve backgroundColor of an HTML Element. But when I check the style with js, everything is either empty or undefined. But when I check this element on developer console it I can see there is a backgroundColor. I could not understand what's wrong. Do you have any tips what can cause this problem?</p>
  
  <pre><code>document.getElementById("id1").style
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/cP7s4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cP7s4.png" alt="JS get style result"></a></p>
  
  <p><a href="https://i.stack.imgur.com/MMRIT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MMRIT.png" alt="Developer console"></a></p>