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

270
Visualizações
Wondering why I am getting duplicate arrays, with the same values. I need to arrange the string values together and integers separately?

Make it so it organizes strings differently from number types. i.e. [1, "2", "3", 2] should return [[1,2], ["2", "3"]]


const stringArray = [1, "2", "3", 2];

function checkArrayString(arr){
    let emptyArray = [];
    let emptyArray2 = [];
    let emptyArray3 = [];

    for(let j=0; j<arr.length; j++){
        if(arr[j]===`${arr[j]}`){                 //looping to find string values in array
            console.log("working");
            emptyArray.push(arr[j]);                
            emptyArray3.push(emptyArray);
        } else{
            console.log("see five working");
            emptyArray2.push(arr[j]);     
            emptyArray3.push(emptyArray2);
            }
    }
    return emptyArray3;
}
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