2018-10-10 18:03:03 -04:00
|
|
|
|
---
|
|
|
|
|
id: 5a23c84252665b21eecc7e7a
|
|
|
|
|
challengeType: 5
|
|
|
|
|
videoUrl: ''
|
2020-10-01 17:54:21 +02:00
|
|
|
|
title: 生成小写ASCII字母表
|
2018-10-10 18:03:03 -04:00
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## Description
|
|
|
|
|
<section id="description">编写一个函数以生成给定范围的小写ASCII字符数组。例如:对于范围1到4,函数应返回<code>['a','b','c','d']</code> 。 </section>
|
|
|
|
|
|
|
|
|
|
## Instructions
|
|
|
|
|
<section id="instructions">
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
## Tests
|
|
|
|
|
<section id='tests'>
|
|
|
|
|
|
|
|
|
|
```yml
|
|
|
|
|
tests:
|
|
|
|
|
- text: <code>lascii</code>应该是一个功能。
|
2020-02-18 01:40:55 +09:00
|
|
|
|
testString: assert(typeof lascii=='function');
|
|
|
|
|
- text: <code>lascii("a","d")</code>应该返回一个数组。
|
|
|
|
|
testString: assert(Array.isArray(lascii('a','d')));
|
|
|
|
|
- text: <code>lascii("a","d")</code>应该返回<code>[ "a", "b", "c", "d" ]</code> 。
|
|
|
|
|
testString: assert.deepEqual(lascii("a","d"),results[0]);
|
|
|
|
|
- text: <code>lascii("c","i")</code>应该返回<code>[ "c", "d", "e", "f", "g", "h", "i" ]</code> 。
|
|
|
|
|
testString: assert.deepEqual(lascii("c","i"),results[1]);
|
|
|
|
|
- text: <code>lascii("m","q")</code>应该返回<code>[ "m", "n", "o", "p", "q" ]</code> 。
|
|
|
|
|
testString: assert.deepEqual(lascii("m","q"),results[2]);
|
|
|
|
|
- text: <code>lascii("k","n")</code>应返回<code>[ "k", "l", "m", "n" ]</code> 。
|
|
|
|
|
testString: assert.deepEqual(lascii("k","n"),results[3]);
|
|
|
|
|
- text: <code>lascii("t","z")</code>应该返回<code>[ "t", "u", "v", "w", "x", "y", "z" ]</code> 。
|
|
|
|
|
testString: assert.deepEqual(lascii("t","z"),results[4]);
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
## Challenge Seed
|
|
|
|
|
<section id='challengeSeed'>
|
|
|
|
|
|
|
|
|
|
<div id='js-seed'>
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
function lascii (cFrom, cTo) {
|
|
|
|
|
// Good luck!
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### After Test
|
|
|
|
|
<div id='js-teardown'>
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
console.info('after the test');
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
## Solution
|
|
|
|
|
<section id='solution'>
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
// solution required
|
|
|
|
|
```
|
2020-08-13 17:24:35 +02:00
|
|
|
|
|
|
|
|
|
/section>
|