1
Hello, I’m starting to study the JS language and I stopped here, I don’t know what my mistake, someone could explain to me what I’m doing wrong?
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>PAGINA</title>
</head>
<body>
<script type="text/javascript">
function calculaRetangulo(b,h) {
var area = (b*h);
var perimetro = (b+h)*2;
return[area,perimetro];
};
</script>
<button type="button" onclick=" var resposta = calculaRetangulo(5,10); alert("AREA: " + resultado[0]); alert("Perimetro" + resultado[1])">EXECUTAR</button>
</body>
</html>


Instead of using double quotes on
alert(), use single quotes. You are already using double quotes around the code, so when you included in the alert the quotes open and close several times– RFL