74 lines
1.6 KiB
Markdown
74 lines
1.6 KiB
Markdown
|
---
|
||
|
id: 587d7b8a367417b2b2512b4e
|
||
|
title: Create Strings using Template Literals
|
||
|
challengeType: 1
|
||
|
videoUrl: ''
|
||
|
localeTitle: ''
|
||
|
---
|
||
|
|
||
|
## Description
|
||
|
undefined
|
||
|
|
||
|
## Instructions
|
||
|
undefined
|
||
|
|
||
|
## Tests
|
||
|
<section id='tests'>
|
||
|
|
||
|
```yml
|
||
|
tests:
|
||
|
- text: ''
|
||
|
testString: 'assert(typeof makeList(result.failure) === "object" && resultDisplayArray.length === 3, "<code>resultDisplayArray</code> is a list containing <code>result failure</code> messages.");'
|
||
|
- text: ''
|
||
|
testString: 'assert(makeList(result.failure).every((v, i) => v === `<li class="text-warning">${result.failure[i]}</li>` || v === `<li class="text-warning">${result.failure[i]}</li>`), "<code>resultDisplayArray</code> is the desired output.");'
|
||
|
- text: ''
|
||
|
testString: 'getUserInput => assert(getUserInput("index").match(/`.*`/g), "Template strings were not used");'
|
||
|
|
||
|
```
|
||
|
|
||
|
</section>
|
||
|
|
||
|
## Challenge Seed
|
||
|
<section id='challengeSeed'>
|
||
|
|
||
|
<div id='js-seed'>
|
||
|
|
||
|
```js
|
||
|
const result = {
|
||
|
success: ["max-length", "no-amd", "prefer-arrow-functions"],
|
||
|
failure: ["no-var", "var-on-top", "linebreak"],
|
||
|
skipped: ["id-blacklist", "no-dup-keys"]
|
||
|
};
|
||
|
function makeList(arr) {
|
||
|
"use strict";
|
||
|
|
||
|
// change code below this line
|
||
|
const resultDisplayArray = null;
|
||
|
// change code above this line
|
||
|
|
||
|
return resultDisplayArray;
|
||
|
}
|
||
|
/**
|
||
|
* makeList(result.failure) should return:
|
||
|
* [ `<li class="text-warning">no-var</li>`,
|
||
|
* `<li class="text-warning">var-on-top</li>`,
|
||
|
* `<li class="text-warning">linebreak</li>` ]
|
||
|
**/
|
||
|
const resultDisplayArray = makeList(result.failure);
|
||
|
|
||
|
```
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
</section>
|
||
|
|
||
|
## Solution
|
||
|
<section id='solution'>
|
||
|
|
||
|
```js
|
||
|
// solution required
|
||
|
```
|
||
|
</section>
|