Created
August 19, 2015 22:06
-
-
Save hattmarris/7a27ca6fcc5302063f1f to your computer and use it in GitHub Desktop.
Array Filter
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
// Array.prototype.filter | |
function containsTest(value) { | |
return value.indexOf('test') != -1; | |
} | |
var a = ['a', 'b', 'c', 'a_test']; | |
var filtered = a.filter(containsTest); | |
// filtered = ['a_test']; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment