Why body without color?

Why when I check for the body background-color it is set to <empty string> ?
Doing it this way :
let doc = document;
let docBodyStyle = doc.querySelector('body').style.backgroundColor;


Wrote clearly in the body tag then it shows but if you specify in the style the empty string
How to achieve js that would read values from css ?
April 7th 20 at 11:06
1 answer
April 7th 20 at 11:08
Solution
You can use getComputedStyle

Find more questions by tags JavaScript