1// Bad:
2element.setAttribute("style", "background-color: red;");
3// Good:
4element.style.backgroundColor = "red";
5
1var elem = document.querySelector('#some-element');
2
3// Set color to purple
4elem.style.color = 'purple';
5
6// Set the background color to a light gray
7elem.style.backgroundColor = '#e5e5e5';
8
9// Set the height to 150px
10elem.style.height = '150px';
11