Last active
April 26, 2024 05:10
-
-
Save fitsum/fa0f603511ba2af458f0e4b7e57ac8dd to your computer and use it in GitHub Desktop.
find in array
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
| f = function(needle,haystack,collect){ | |
| collection = []; | |
| haystack.filter(function(item){ | |
| if(typeof item === "string" && item.match(needle)!== null) | |
| collect += item; | |
| }) | |
| return collect; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment