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

99
Visualizações
How to ignore escape characters in string.length javascript?

I have a NodeJS script that finds the longest string in a list, then appends spaces to make all other strings the same length. I have a problem, because I am using Chalk to color certain strings. The escape codes chalk produces are long, and when I get the length of 2 strings, let's say one is let 1 = chalk.greenBright("test") which its length should be 4, but it returns 14, and we have the other variable let 2 = "lorem ipsum" which its length should be 11. When I call .length, 1 is bigger than the other therefore causing this issue: (using E as space)

lorem ipsumEEE
test

Instead of the intended result:

lorem ipsum
testEEEEEEE
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