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

286
Vistas
Javascript weird behavior with REGEX parsed values

Can anyone please explain this to me? I am running the following code with the following input:

var results = [];
var tokenRegExp = /\s*([A-Za-z]+|[0-9]+|\S)\s*/g;
var m;
while ((m = tokenRegExp.exec(code)) !== null) {
    results.push(m[1].toString() //I added the toString to see if it would change anything, it did absolutely nothing. I was running it without before that);
}
return results;

The input of "code" is 3+3+6*6*5*8/9-6

And then I am seeing this extremely strange behavior in the console... where the output array appears to be correct until you expand it

enter image description here

Thanks....

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