Increment letters in JavaScript

function lettersLoop(from, to, callback) { var i = from.charCodeAt(0); var to = to.charCodeAt(0); for(;i<=to;i++) callback(String.fromCharCode(i)); } var sequence = ""; lettersLoop("A", "Z", function(char) { sequence += char + " "; }); document.body.innerHTML = sequence;

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.