Last active
August 10, 2019 11:58
-
-
Save AshishKapoor/2b1228ceda54ad83fb59b313a1d9f345 to your computer and use it in GitHub Desktop.
Search letter wise in an array using JavaScript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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