Create strings using template literals recursion issue

Tell us what’s happening:
The function prints out the failure strings from the array, but not in separate lines like the question wants. I felt the for loop was too easy so I tried recursion and tried googling my problem but I could not really find anything.

  **Your code so far**
const result = {
success: ["max-length", "no-amd", "prefer-arrow-functions"],
failure: ["no-var", "var-on-top", "linebreak"],
skipped: ["no-extra-semi", "no-dup-keys"]
function makeList(arr) {
// Only change code below this line
const failureItems = [];
if(failureItems < 0){
  return [];
  failureItems.push(`<li class="text-warning">${arr}</li`);
// Only change code above this line

return failureItems;

const failuresList = makeList(result.failure);
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36

Challenge: Create Strings using Template Literals

Link to the challenge:

Hey @Goob, the point of this exercise isn’t to print out the strings to the console, it’s to create a function that returns an array of string:

“The makeList function should return the array of list item strings.”

So I would concentrate on that instead. Also, a recursive function calls itself, so you would need to make a call to makeList inside of the makeList function. You can definitely use recursion here if you want, but you need to concentrate on building up the array you are going to return.

Easy to read, easy to reason about code is a good thing. I don’t think you should intentionally write difficult code.

I understand that, I just wanted to try to solve this in recursion to get a better understanding of the concept of recurion.

Hey thanks for the help, figured that out after finding a question similar to mine on stackOverflow

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.