# BUG: ES6 string templates challenge (with solution)

**URL:** <https://forum.freecodecamp.org/t/bug-es6-string-templates-challenge-with-solution/339185>\
**Category:** General\
**Created:** [January 7, 2020, 4:42pm UTC](https://forum.freecodecamp.org/t/bug-es6-string-templates-challenge-with-solution/339185 "2020-01-07T16:42:50Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![tommygebru](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/tommygebru/32/44370_2.png) [@tommygebru](https://forum.freecodecamp.org/u/tommygebru)\
**Post date:** [January 7, 2020, 4:42pm UTC](https://forum.freecodecamp.org/t/bug-es6-string-templates-challenge-with-solution/339185/1 "2020-01-07T16:42:50Z")

</div>

The challenge has a bug with the starting code base

[https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals](https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals)

Specifically line 21

```auto
const resultDisplayArray = makeList(result.failure);

```

this needs to be changed to

```auto
makeList(result.failure);

```

@camperextraordinaire

---

<div class="post-metadata">

**Author:** ![tommygebru](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/tommygebru/32/44370_2.png) [@tommygebru](https://forum.freecodecamp.org/u/tommygebru)\
**Post date:** [January 7, 2020, 4:44pm UTC](https://forum.freecodecamp.org/t/bug-es6-string-templates-challenge-with-solution/339185/2 "2020-01-07T16:44:39Z")

</div>

Also here is my solution on Replit  
[https://repl.it/join/ibjcilvs-tommygebru](https://repl.it/join/ibjcilvs-tommygebru)

The first 2 test cases wont pass on FCC

 ![12%20AM](https://global.discourse-cdn.com/freecodecamp/original/3X/8/8/88a9b96ac89845dc0129b827ee4c9bd279b68568.png)

---

<div class="post-metadata">

**Author:** ![tommygebru](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/tommygebru/32/44370_2.png) [@tommygebru](https://forum.freecodecamp.org/u/tommygebru)\
**Post date:** [January 7, 2020, 6:01pm UTC](https://forum.freecodecamp.org/t/bug-es6-string-templates-challenge-with-solution/339185/5 "2020-01-07T18:01:41Z")

</div>

Did i misunderstand the challenge perhaps?

If we go with the original codebase again, i think the last lines should include the callback function… not just defining it…  
For Example

```auto
const resultDisplayArray = makeList(result.failure);

```

should become

```auto
const resultDisplayArray = makeList(result.failure);
resultDisplayArray;

```

@camperextraordinaire I see that I had an unnecessary `space` in my template string, but i think that my previous concerns still apply ☝☝

---

<div class="post-metadata">

**Author:** ![lasjorg](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/lasjorg/32/280761_2.png) [@lasjorg](https://forum.freecodecamp.org/u/lasjorg)\
**Post date:** [January 7, 2020, 6:16pm UTC](https://forum.freecodecamp.org/t/bug-es6-string-templates-challenge-with-solution/339185/6 "2020-01-07T18:16:47Z")

</div>

What callback? The function `makeList` returns an array that is captured in the `resultDisplayArray`, which is use by the test to check the length of the array.

There is no bug, but I do find it an odd choice to have two variables in different scopes with the same name (`resultDisplayArray`). Seems like both a bad coding practice and a possibly confusing approach to the student. Why not use variables with different names?

---

<div class="post-metadata">

**Author:** ![tommygebru](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/tommygebru/32/44370_2.png) [@tommygebru](https://forum.freecodecamp.org/u/tommygebru)\
**Post date:** [January 7, 2020, 6:19pm UTC](https://forum.freecodecamp.org/t/bug-es6-string-templates-challenge-with-solution/339185/7 "2020-01-07T18:19:29Z")

</div>

Well the challenge works in the FCC editor, but the code itself wont run in external editors like Replit

```auto
//this line 
const resultDisplayArray = makeList(result.failure);
//still requires being called
resultDisplayArray;

```

if that makes sense @lasjorg

---

<div class="post-metadata">

**Author:** ![lasjorg](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/lasjorg/32/280761_2.png) [@lasjorg](https://forum.freecodecamp.org/u/lasjorg)\
**Post date:** [January 7, 2020, 6:28pm UTC](https://forum.freecodecamp.org/t/bug-es6-string-templates-challenge-with-solution/339185/8 "2020-01-07T18:28:32Z")

</div>

It does run. You’re just not seeing the result because you are not doing anything with it. You can log it out if you want, `console.log(resultDisplayArray)`. IRL, it would be use with DOM manipulation to add the HTML to the DOM/page.

This…  
`resultDisplayArray;`  
does not do anything. It is just an array.

```auto
console.log(typeof resultDisplayArray)
// object
console.log(typeof makeList)
// function

```

---

<div class="post-metadata">

**Author:** ![tommygebru](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/tommygebru/32/44370_2.png) [@tommygebru](https://forum.freecodecamp.org/u/tommygebru)\
**Post date:** [January 7, 2020, 6:42pm UTC](https://forum.freecodecamp.org/t/bug-es6-string-templates-challenge-with-solution/339185/9 "2020-01-07T18:42:03Z")

</div>

I wanted to share my invite link to the replit, i dont know if there is an edit feature or “multiplayer”  
[https://repl.it/join/ibjcilvs-tommygebru](https://repl.it/join/ibjcilvs-tommygebru)

---

<div class="post-metadata">

**Author:** ![lasjorg](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/lasjorg/32/280761_2.png) [@lasjorg](https://forum.freecodecamp.org/u/lasjorg)\
**Post date:** [January 7, 2020, 6:52pm UTC](https://forum.freecodecamp.org/t/bug-es6-string-templates-challenge-with-solution/339185/10 "2020-01-07T18:52:36Z")

</div>

Is it not just the same code as you have in the screenshot? Why do you want to link to the repl, do you have a question?

You can post links to anonymous repls (should be the same as your code, plus the console logs).  
https://repl.it/repls/RequiredCircularPatches?lite=true

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [June 1, 2021, 7:38pm UTC](https://forum.freecodecamp.org/t/bug-es6-string-templates-challenge-with-solution/339185/11 "2021-06-01T19:38:25Z")

</div>


