Does anyone know of a Javascript library (e.g. underscore, jQuery, MooTools, etc.) that offers a method of incrementing a letter?
I would like to be able to do somet
I needed to use sequences of letters multiple times and so I made this function based on this SO question. I hope this can help others.
function charLoop(from, to, callback)
{
var i = from.charCodeAt(0);
var to = to.charCodeAt(0);
for(;i<=to;i++) callback(String.fromCharCode(i));
}
How to use it:
charLoop("A", "K", function(char) {
//char is one letter of the sequence
});
See this working demo