Skip to content

Instantly share code, notes, and snippets.

@glebcha
Created September 18, 2013 09:56
Show Gist options
  • Save glebcha/6606984 to your computer and use it in GitHub Desktop.
Save glebcha/6606984 to your computer and use it in GitHub Desktop.
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