Created
September 18, 2013 09:56
-
-
Save glebcha/6606984 to your computer and use it in GitHub Desktop.
This file contains 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 arr = []; | |
var testValues = function(value) { | |
return /keyword_here/.test(value); | |
}; | |
var addPrefix = function(value) { | |
return 'prefix '+value; | |
}; | |
var links = document.querySelectorAll('a'); | |
;(function() { | |
for (var i = 0; i < links.length; i++) { | |
var link = links[i].toString(); | |
arr.push(link); | |
} | |
})(); | |
var filteredArray = arr.filter(testValues); | |
var filteredArrayWithPrefixes = filteredArray.map(addPrefix); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment