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

304
Visualizações
how to print all values from an array containing a given string value (JavaScript)

Given an array like the below code :

let words = ['bring','constant','bath','spring','splashing']

How do I print all string characters with ing characters from the words array ?

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

You need to use endsWith method to check if the word ends with a specific value.

let words = ['bring','constant','bath','spring','splashing']

const result = words.filter(w => w.endsWith('ing'))

result.forEach(w => console.log(w))

You also can use regular expressions with dollar sign $ means end with.

let words = ['bring','constant','bath','spring','splashing']

const result = words.filter(w => /(ing)$/.test(w))

result.forEach(w => console.log(w))

about 4 years ago · Juan Pablo Isaza Relatório

0

As author want to check if ing exist in the middle of the word or not. In that case you can just use normal regex with String.match() method without $ sign at end.

Live Demo :

let words = ['bring','constant','bath','spring','splashing', 'tingtong'];

const res = words.filter(word => word.match(/ing/ig));

console.log(res);

Or you can also achieve that by using .includes() method.

Live Demo :

let words = ['bring','constant','bath','spring','splashing', 'tingtong'];

const res = words.filter(word => word.includes('ing'));

console.log(res);

about 4 years ago · Juan Pablo Isaza Relatório
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