Build an fCC Authors Page - Step 12

Tell us what’s happening:

Why isnt it correct if it has everything it asks for

Your code so far

<!-- file: index.html -->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>freeCodeCamp News Author Page</title>
    <link rel="stylesheet" href="./styles.css" />
  </head>
  <body>
    <h1 class="title">freeCodeCamp News Author Page</h1>

    <main>
      <div id="author-container"></div>
      <button class="btn" id="load-more-btn">Load More Authors</button>
    </main>

    <script src="./script.js"></script>
  </body>
</html>
/* file: styles.css */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --main-bg-color: #1b1b32;
  --light-grey: #f5f6f7;
  --dark-purple: #5a01a7;
  --golden-yellow: #feac32;
}

body {
  background-color: var(--main-bg-color);
  text-align: center;
}

.title {
  color: var(--light-grey);
  margin: 20px 0;
}

#author-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}

.user-card {
  border-radius: 15px;
  width: 300px;
  height: 350px;
  background-color: var(--light-grey);
  margin: 20px;
}

.user-img {
  width: 150px;
  height: 150px;
  object-fit: cover;
}

.purple-divider {
  background-color: var(--dark-purple);
  width: 100%;
  height: 15px;
}

.author-name {
  margin: 10px;
}

.bio {
  margin: 20px;
}

.error-msg {
  color: var(--light-grey);
}

.btn {
  cursor: pointer;
  width: 200px;
  margin: 10px;
  color: var(--main-bg-color);
  font-size: 14px;
  background-color: var(--golden-yellow);
  background-image: linear-gradient(#fecc4c, #ffac33);
  border-color: var(--golden-yellow);
  border-width: 3px;
}
/* file: script.js */
const authorContainer = document.getElementById('author-container');
const loadMoreBtn = document.getElementById('load-more-btn');

let startingIndex = 0;
let endingIndex = 8;
let authorDataArr = [];

fetch('https://cdn.freecodecamp.org/curriculum/news-author-page/authors.json')
  .then((res) => res.json())
  .then((data) => {
    authorDataArr = data;
    displayAuthors(authorDataArr.slice(startingIndex, endingIndex));
  })
  .catch((err) => {
    console.error(`There was an error: ${err}`);
  });

const displayAuthors = (authors) => {
  authors.forEach(({ author, image, url, bio }, index) => {
    authorContainer.innerHTML += `
    <div id="${index}" class="user-card">
      <h2 class="author-name">${author}</h2>

// User Editable Region

      <img class="user-img" src="${image}" alt="${author} avatar">

// User Editable Region

    </div>
  `;
  });
};

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0

Challenge Information:

Build an fCC Authors Page - Step 12
https://www.freecodecamp.org/learn/full-stack-developer/workshop-fcc-authors-page/step-12

Your code works on my end. Please reset the step and try again.

I keep trying but it just doesnt work, ill try tomorrow ig

Sorry to hear that. Here the full list of things you can try:

Click on the “Restart Step” button and force a refresh of your page with CTRL + F5 then try to paste the code in again.

or - Try the step in incognito or private mode.

or - Disable any/all extensions that interface with the freeCodeCamp website (such as Dark Mode, Ad Blockers, or Spellcheckers), and set your browser zoom level to 100%. Both of these factors can cause tests to fail erroneously.

or - Ensure your browser is up-to-date or try a different browser.

I hope one of these will work for you.

I have discovered something, it only fails in this part im doing, the part where I add elements to the DOM wont accept any correct answer for me, I skipped to step 15 and my solutions work again. Im somehow not able to solve from 11-14, weird.

update, the step 21 does the same as 11-14, I cannot pass tests that involve template literals

If you’ve gone through all of the steps to try to correct it, you may want to create a new topic under the “freeCodeCamp Support” category or open a GitHub issue for this.

please if you create a support post (or an issue), include the errors you get in the browser console, the one you open with F12 (probably? it depends on the browser)

I get a syntax error:
SyntaxError: await is only valid in async functions, async generators and modules
https://www.freecodecamp.org/js/test-runner/5.4.1/dom-test-evaluator.js:2
handleMessage https://www.freecodecamp.org/js/test-runner/5.4.1/dom-test-evaluator.js:2
onmessage https://www.freecodecamp.org/js/test-runner/5.4.1/dom-test-evaluator.js:2
EventHandlerNonNull* https://www.freecodecamp.org/js/test-runner/5.4.1/dom-test-evaluator.js:2
https://www.freecodecamp.org/js/test-runner/5.4.1/dom-test-evaluator.js:2
https://www.freecodecamp.org/js/test-runner/5.4.1/dom-test-evaluator.js:2
dom-test-evaluator.js:2:255516
https://www.freecodecamp.org/js/test-runner/5.4.1/dom-test-evaluator.js:2
handleMessage https://www.freecodecamp.org/js/test-runner/5.4.1/dom-test-evaluator.js:2
onmessage https://www.freecodecamp.org/js/test-runner/5.4.1/dom-test-evaluator.js:2
(Async: EventHandlerNonNull)
https://www.freecodecamp.org/js/test-runner/5.4.1/dom-test-evaluator.js:2
https://www.freecodecamp.org/js/test-runner/5.4.1/dom-test-evaluator.js:2
https://www.freecodecamp.org/js/test-runner/5.4.1/dom-test-evaluator.js:2

try clearing the cache of your browser, or try updating your browser to the latest version or try a different browser

this issue mentions an await related error, you can add your experience there, make sure to report which browser you are using, and the error you are getting