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

305
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
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