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

185
Visualizações
the DOM doesn't work with me when I try min and max and it show NaN

when I run it gave me a NaN and I have tried many times. here's the javascript file and HTML file

javascrit file:

function MinButton(){
    var td1Text = document.getElementById("td1").textContent;

    // Get array of numbers from text
     var OriginalArray = td1Text.split(",").map(function(num){
       return parseInt(num,10);
     });
    
    // Get td2
    var Min =  document.getElementById("MinTable");
    
    // Set td2 to sorted array converted to string
    Min.textContent = parseInt(Math.min(OriginalArray));
}

HTML file:

<tr>
            

    <th>Original array</th>
                    <!--<td><input type="text" id="textO"  size="40"></td>-->
               

         <td id ="td1">1,5,7,-1,3</td>
        </tr>
    <tr>
                    <th>Sorted Array</th>
                    <td id="td2"></td>
    </tr>    
<input type="button" value="Find Min" id="Min" onclick="MinButton();">
about 4 years ago · Juan Pablo Isaza
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