// Here are two different ways document.getElementById("myH1").style.color = "red"; element.style.backgroundColor = "red"; // set the background color of an element to red
//to get all style const style = getComputedStyle(element) //or to get inline style const style = element.style const backgroundColor = style.backgroundColor console.log(backgroundColor) // rgb(0, 0, 0)