Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with boilerplate #15

Closed
kylecoberly opened this issue Apr 25, 2020 · 1 comment
Closed

Problem with boilerplate #15

kylecoberly opened this issue Apr 25, 2020 · 1 comment

Comments

@kylecoberly
Copy link

function renderBooks(json) {
  const main = document.querySelector('main')
  json.forEach(book => {
    const h2 = document.createElement('h2')
    h2.innerHTML = `<h2>${book.name}</h2>`
    main.appendChild(h2)
  })
}

Some problems with this:

  • Calling .json() doesn't turn a response into JSON- it turns a JSON string into a JS object. This function should take in something like books.
  • Setting the innerHTML of an h2 to an h2 nests them: <h2><h2>A Tale of Two Cities</h2></h2>
@maxwellbenton
Copy link
Contributor

Hey @kylecoberly,

Thanks for this feedback. I've updated the starter code to use books and removed the extra h2 tags being set with innerHTML. This issue should now be resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants