So, I've a code that is below which works just fine:
<html>
<head>
<title> Javascript Practice </title>
</head>
<body>
<div id="myDiv">
</div>
<script>
var a = 0;
var b = 255;
var c = 0;
var color2 = 'RGB(' + a + ',' + b + ',' + c + ')';
document.getElementById("myDiv").style.backgroundColor = color2;
document.getElementById("myDiv").style.width = 50;
document.getElementById("myDiv").style.height = 300;
</script>
</body>
</html>
I've got a lot of feedback saying that when accessing DOM style property, I need to set value as strings such as setting DOM.style.width not to a number like I've done here but appending w + "px"
I'm puzzled because I'm using Brackets as a code editor and deploying this on chrome. My code runs just fine and every time I load the HTML page, it initializes a div of the required dimensions. Everyone tells me it won't work which is what's confusing me.
TIA.