Skip to content

Instantly share code, notes, and snippets.

@AshishKapoor
Last active August 10, 2019 11:58
Show Gist options
  • Save AshishKapoor/2b1228ceda54ad83fb59b313a1d9f345 to your computer and use it in GitHub Desktop.
Save AshishKapoor/2b1228ceda54ad83fb59b313a1d9f345 to your computer and use it in GitHub Desktop.
Search letter wise in an array using JavaScript
// Search letter wise in an array using JavaScript
var words = ['spray', 'limit', 'elite', 'exuberant', 'destruction', 'present'];
const result = words.filter(word => word.indexOf('des') !== -1);
console.log(result); // > Array ["destruction"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment