Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

178
Visualizações
Problema cuando presiono el botón tengo un error en el registro de la consola que dice que mi función no está definida

Cuando haces clic en el botón, la consola dice:

project3.html:48 Error de referencia no detectado: findnembers no está definido en HTMLButtonElement.onclick (project3.html:48)

¿Porqué es eso?

 <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>project3</title> </head> <body dir="ltr"> <button id="click here to calculate" onclick="findnembers();" type=button>click here to calculate </button> <div id='rslt' style='text-align: center;font-size: 1em; font-weight: bolder;' value=""></div> <script> function sumdigits(num) { sum = 0; while (num) { sum += num % 10; num = Math.floor(num / 10); } return sum; } function findnembers() { var counter = 0; var list='<ol>'; for (let i = 0; i < 9999; i++) { var ezer = sumdigits(i); if (ezer === 9) { list+= "<li>" + i + "</li>"; counter++; } list += "</ol>"; } var print=list+ <p style='text-align: center;font-size: 1em; font-weight: bolder;'>"The sum of digits of those number is 9, and they are in the range 0 to 9999 inclusive and their quantity is "{counter}</p>; document.getElementById("rslt").innerHTML=print; } </script> </body> </html>```
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

como dijo @kinglish citando. debería ser así

 var print=`${list}<p style='text-align: center;font-size: 1em; font-weight: bolder;'>"The sum of digits of those number is 9, and they are in the range 0 to 9999 inclusive and their quantity is "${counter}</p>`;
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda