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

160
Visualizações
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 à 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