Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

303
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!