JSFiddle - React, Tailwind, and code Playground
JavaScript
function range( start, limit ){
var assoc_array = {};
var step = 1;
var DEFAULT_VALUE = "some value";
step *= limit.charCodeAt(0) - start.charCodeAt(0) > 0 ? 1:-1;
while( start !== limit ){
assoc_array[ start ] = DEFAULT_VALUE;
start = String.fromCharCode(start.charCodeAt(0)+step);
}
assoc_array[ limit ] = DEFAULT_VALUE;
return assoc_array;
}
console.log( JSON.stringify(range('a','z'),null,'\t'));
console.log( JSON.stringify(range('z','x'),null,'\t'));