In Ruby I can do (\'a\'..\'z\').to_a and to get [\'a\', \'b\', \'c\', \'d\', ... \'z\'].
Do jQuery or Javascript provide a similar construc
Just for fun, then you can define a getter on the Array prototype:
Object.defineProperty(Array.prototype, 'to_a', {
get: function () {
const start = this[0].charCodeAt(0);
const end = this[1].charCodeAt(0);
return Array.from(Array(end - start + 1).keys()).map(n => String.fromCharCode(start + n));
}
});
Which makes it possible to do something like:
['a', 'z'].to_a; // [ "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", ..., "z" ]