How to print all strings from an array that contain a given substring in Node.js

1 Answer

0 votes
const words = ['property', 'node.js', 'multiprocessing', 'c++', 'java', "weatherproofing"]
  
const result = words.filter(word => word.includes('pro'));
  
result.forEach(w => console.log(w))
  
  
  
/*
run:
  
property
multiprocessing
weatherproofing
  
*/

 



answered Dec 18, 2023 by avibootz
...