2018-10-10 18:03:03 -04:00
---
id: 5a23c84252665b21eecc7e7a
2021-02-06 04:42:36 +00:00
title: Generate lower case ASCII alphabet
2018-10-10 18:03:03 -04:00
challengeType: 5
2021-02-06 04:42:36 +00:00
forumTopicId: 302274
2021-01-13 03:31:00 +01:00
dashedName: generate-lower-case-ascii-alphabet
2018-10-10 18:03:03 -04:00
---
2020-12-16 00:37:30 -07:00
# --description--
2018-10-10 18:03:03 -04:00
2021-02-06 04:42:36 +00:00
Write a function to generate an array of lower case ASCII characters for a given range. For example, given the range `['a', 'd']` , the function should return `['a', 'b', 'c', 'd']` .
2018-10-10 18:03:03 -04:00
2020-12-16 00:37:30 -07:00
# --hints--
2018-10-10 18:03:03 -04:00
2021-02-06 04:42:36 +00:00
`lascii` should be a function.
2018-10-10 18:03:03 -04:00
2020-12-16 00:37:30 -07:00
```js
assert(typeof lascii == 'function');
```
2021-02-06 04:42:36 +00:00
`lascii("a","d")` should return an array.
2018-10-10 18:03:03 -04:00
```js
2020-12-16 00:37:30 -07:00
assert(Array.isArray(lascii('a', 'd')));
```
2018-10-10 18:03:03 -04:00
2021-02-06 04:42:36 +00:00
`lascii('a','d')` should return `[ 'a', 'b', 'c', 'd' ]` .
2020-12-16 00:37:30 -07:00
```js
assert.deepEqual(lascii('a', 'd'), results[0]);
2018-10-10 18:03:03 -04:00
```
2021-02-06 04:42:36 +00:00
`lascii('c','i')` should return `[ 'c', 'd', 'e', 'f', 'g', 'h', 'i' ]` .
2018-10-10 18:03:03 -04:00
2020-12-16 00:37:30 -07:00
```js
assert.deepEqual(lascii('c', 'i'), results[1]);
```
2018-10-10 18:03:03 -04:00
2021-02-06 04:42:36 +00:00
`lascii('m','q')` should return `[ 'm', 'n', 'o', 'p', 'q' ]` .
2018-10-10 18:03:03 -04:00
```js
2020-12-16 00:37:30 -07:00
assert.deepEqual(lascii('m', 'q'), results[2]);
2018-10-10 18:03:03 -04:00
```
2021-02-06 04:42:36 +00:00
`lascii('k','n')` should return `[ 'k', 'l', 'm', 'n' ]` .
2018-10-10 18:03:03 -04:00
2020-12-16 00:37:30 -07:00
```js
assert.deepEqual(lascii('k', 'n'), results[3]);
```
2018-10-10 18:03:03 -04:00
2021-02-06 04:42:36 +00:00
`lascii('t','z')` should return `[ 't', 'u', 'v', 'w', 'x', 'y', 'z' ]` .
2018-10-10 18:03:03 -04:00
```js
2020-12-16 00:37:30 -07:00
assert.deepEqual(lascii('t', 'z'), results[4]);
2018-10-10 18:03:03 -04:00
```
2020-08-13 17:24:35 +02:00
2021-01-13 03:31:00 +01:00
# --seed--
## --after-user-code--
```js
let results=[
[ 'a', 'b', 'c', 'd' ],
[ 'c', 'd', 'e', 'f', 'g', 'h', 'i' ],
[ 'm', 'n', 'o', 'p', 'q' ],
[ 'k', 'l', 'm', 'n' ],
[ 't', 'u', 'v', 'w', 'x', 'y', 'z' ]
]
```
## --seed-contents--
```js
function lascii(cFrom, cTo) {
}
```
2020-12-16 00:37:30 -07:00
# --solutions--
2021-01-13 03:31:00 +01:00
```js
function lascii(cFrom, cTo) {
function cRange(cFrom, cTo) {
var iStart = cFrom.charCodeAt(0);
return Array.apply(
null, Array(cTo.charCodeAt(0) - iStart + 1)
).map(function (_, i) {
return String.fromCharCode(iStart + i);
});
}
return cRange(cFrom, cTo);
}
```