I need the average to be displayed by an alert ()
HTML:
function calculoMedia(n1, n2, n3, n4) {
var media;
var n1 = getElementById('n1').value;
var n2 = getElementById('n2').value;
var n3 = getElementById('n3').value;
var n4 = getElementById('n4').value;
media = (n1 + n2 + n3 + n4) / 4;
alert("Média das notas: " + media + "");
}
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8" />
<script language="JavaScript" src="code.js"></script>
<title>Médias</title>
</head>
<body>
<form>
Nota 1:<br>
<input type="number" id="n1"><br> Nota 2:<br>
<input type="number" id="n2"><br> Nota 3:<br>
<input type="number" id="n3"><br> Nota 4:<br>
<input type="number" id="n4"><br><br>
<input type="button" onclick="javascript:calculoMedia();" value="Calcular Média">
</form>
</body>
</html>