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

150
Vistas
why isnt michael jordan matching in my regexp

my code is supposed to match all of the key names that contain the inputted string. however when i enter "o" it wont match jordanMichael but will match noahsinnott and bobross. does anyone know why? this also happens when i enter 0 as it only matches noah when harry styles also has a zero in his key. when matched with no string it also returns all the keys so i know it is defiantly running him through the test but for some reason he never passes.

var adressLog = {
  NoahSinnott07484743803: {
    firstName: "Noah",
    lastName: "Sinnott",
    number: 07484743803,
    adress: "st michaels house, church street, billinghay"
  },

  HarryStlyes08674563827: {
    firstName: "Harry",
    lastName: "Styles",
    number: 08674563827,
    adress: "23 Merry gold lane, new-york"
  },

  BobRoss67543456754: {
    firstName: "Bob",
    lastName: "Ross",
    number: 67543456754,
    adress: "93 Scrooby Rd, Bircotes, Doncaster DN11 8JN"
  },

  JordanMichael78675678765: {
    firstName: "Jordan",
    lastName: "Michael",
    number: 78675678765,
    adress: "2700 Point Dr, Highland Park, IL 60035"
  }
};

function match(str) {
  a = new RegExp(str, "ig");
  let matches = [];
  let length = Object.keys(adressLog).length;
  for (let p = 0; p < length; p++) {
    current = Object.keys(adressLog)[p];
    if (a.test(current) == true) {
      matches.push(current);
    }
  }
  console.log(matches);
}
match("o");

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