Your mistake is here, calling the function pL
:
function mostra(frase) {
document.write(frase);
pL(); // esse chamada ativa a recursão infinita....
};
That call pL
calls again the function mostra
and this internally calls the function pL
that calls again mostra
and so on... and this generates an infinite recursion, which will generate the error:
"Uncaught Rangeerror: Maximum call stack size exceeded"
The simplest way for your case would be to ignore that function pL
and work only with mostra
, and in the parameters you would pass a <br>
and the <hr>
var mT = parseInt(prompt("A tabuada de qual numero deseja ver?(preencha somente com o numero.)"));
var n = 1;
function mostra(frase) {
document.write(frase);
};
while (n <= 10) {
mostra(mT + " * " + n + " = " + mT * n + '<br><hr>'); // passa '<br><hr>' aqui para quebrar a linha
n = n + 1;
};
<html>
<head>
<script>
</script>
</head>
<body bgcolor=000000 text=FF0000>
<script>
console.log("apenas para o body :)");
</script>
</body>
</html>
Questions that talk about infinite recursion error: