Code One
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Learn JavaScript</title>
<script>
// Code One
document.getElementById("el").style.color = "red";
</script>
/* the Code One does not work because it don't
find which thr are loading*/
<script>
// Code Two
window.onload = function () {
document.getElementById("el").style.color = "red";
};
</script>
</head>
<body>
<h1 id="el">Page Title</h1>
<script>
// Code Three
document.getElementById("el").style.color = "red";
</script>
</body>
</html>