El HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="main2.js"></script>
</head>
<body>
<label>Números impares de 1 al 100 </label><br><br>
<button onclick="pares();">Calcular</button>
<p id="numbers"> </p>
</body>
</html>
El archivo main2.js
function pares(){
var i = 1;
var numeros = "";
while (i <= 100){
if((i%2)==0){
numeros += i + "<br>";
i++;
}
i++;
}
numeros += " FINAL";
document.getElementById("numbers").innerHTML = numeros;
}