Created
August 14, 2016 08:56
-
-
Save karlpokus/0b39d52d8fcb3b663cd5950f972fc922 to your computer and use it in GitHub Desktop.
Array filter by regex and some weird arguments applied
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
var matches = ["sun", "clouds", "rain", "hail", "snow"].filter(/./.test, /i/); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Found this awesome snippet above at SO by user @rndme I really want to know how it works but I can't seem to find any contact info on either SO nor github and I'm not allowed to comment on SO. Here's hoping to him seeing this gist 😃
I get the part where you pass
regex.test
to filter but the second arg/i/
is to be used asthis
and that's what puzzles me.