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

208
Vistas
Sorting numbers in multiple columns and moving empty or null to the bottom

I want to sort 2 columns and gettin the empty rows to the bottom, but i am a bit stuck on it. I've found multiple examples of both, and I can get them working separately from each other, but not simultaneous. Can somebody please provide me with an example?

    results.sort(   (a, b) => {
    var key = racetimefieldnames[setlastpartiallyfullcolumn];
    var keybefore = racetimefieldnames[setlastpartiallyfullcolumn-1];
    var aa = a[keybefore];
    var bb = b[keybefore];
    a = a[key];
    b = b[key];
    
    
    
    if(a === "" || a === null) return 1;
    if(b === "" || b === null) return -1;

    if (a > b) return 1;
    if (a < b) return -1;
    
    
    if (aa > bb) return 1;
    if (aa < bb) return -1;
    
    return 0;
    }); 
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