BUG: ES6 string templates challenge (with solution)

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

Specifically line 21

const resultDisplayArray = makeList(result.failure);

this needs to be changed to

makeList(result.failure);

@camperextraordinaire

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

The first 2 test cases wont pass on FCC

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

const resultDisplayArray = makeList(result.failure);

should become

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 :point_up::point_up:

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?

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

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

if that makes sense @lasjorg

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.

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

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

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).