Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

267
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda