From 2743ac2e84c8d565b1c2d37b1c56fc59c982c0a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lasse=20J=C3=B8rgensen?= <28780271+lasjorg@users.noreply.github.com> Date: Thu, 10 Sep 2020 02:58:27 +0200 Subject: [PATCH] fix(challenge): update variable names, assign empty array, update solution code, remove "use strict" (#39525) * fix(challenge): update variable names, assign empty array, update solution code, remove "use strict" * fix(challenge): update solution code * fix:(challenge) update instructions and variable name * fix:(challenge) update instructions --- ...strings-using-template-literals.english.md | 24 +++++++------------ 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.english.md index 80b1a21434..9bef6bff4b 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.english.md @@ -36,7 +36,7 @@ This new way of creating strings gives you more flexibility to create robust str ## Instructions
-Use template literal syntax with backticks to display each entry of the result object's failure array. Each entry should be wrapped inside an li element with the class attribute text-warning, and listed within the resultDisplayArray. +Use template literal syntax with backticks to create an array of list element (li) strings. Each list element's text should be one of the array elements from the failure property on the result object and have a class attribute with the value text-warning. The makeList function should return the array of list item strings. Use an iterator method (any kind of loop) to get the desired output (shown below). ```js @@ -54,9 +54,9 @@ Use an iterator method (any kind of loop) to get the desired output (shown below ```yml tests: - - text: resultDisplayArray should be an array containing result failure messages. - testString: assert(typeof makeList(result.failure) === 'object' && resultDisplayArray.length === 3); - - text: resultDisplayArray should be equal to the specified output. + - text: failuresList should be an array containing result failure messages. + testString: assert(typeof makeList(result.failure) === 'object' && failuresList.length === 3); + - text: failuresList should be equal to the specified output. testString: assert(makeList(result.failure).every((v, i) => v === `
  • ${result.failure[i]}
  • ` || v === `
  • ${result.failure[i]}
  • `)); - text: Template strings and expression interpolation should be used. testString: getUserInput => assert(getUserInput('index').match(/(`.*\${.*}.*`)/)); @@ -78,16 +78,14 @@ const result = { skipped: ["no-extra-semi", "no-dup-keys"] }; function makeList(arr) { - "use strict"; - // Only change code below this line - const resultDisplayArray = null; + const failureItems = []; // Only change code above this line - return resultDisplayArray; + return failureItems; } -const resultDisplayArray = makeList(result.failure); +const failuresList = makeList(result.failure); ``` @@ -106,14 +104,10 @@ const result = { skipped: ["no-extra-semi", "no-dup-keys"] }; function makeList(arr) { - "use strict"; - - const resultDisplayArray = arr.map(val => `
  • ${val}
  • `); - - return resultDisplayArray; + return arr.map(val => `
  • ${val}
  • `); } -const resultDisplayArray = makeList(result.failure); +const failuresList = makeList(result.failure); ```