I’m using Isotope to filter items with names beginning with A through to Z.
Rather then creating 26 filter functions I would like to create a loop which loops through an array A to Z.
This is what I have for the first 2 functions, I’m not sure how to declare my array A-Z and then loop through them to create a filter function for each letter of the alphabet.
// filter functions
var filterFns = {
// show if name begins with A
A: function() {
var name = $(this).find('.name').text();
return name.startsWith( "A" );
},
// show if name begins with B
B: function() {
var name = $(this).find('.name').text();
return name.startsWith( "B" );
}
};