L
L
Lucius132021-06-21 14:30:28
JavaScript
Lucius13, 2021-06-21 14:30:28

Why js is not shown in the browser console?

async function getResponse() 
{
    let response = await fetch('https://jsonplaceholder.typicode.com/photos')
    let content = await response.json()
    content = content.splice(0, 10)

    let list = document.querySelector('.posts')

    let key;

    for (key in content) {

        list.innerHTML +=`
        <li class="post">
        <h4>${content[key].title}</h4>
        <img src="${content[key].url}" width="300">
    </li>
        `

        content[key]
    }

    console.log(content)
}

getResponse()


I am writing the code for this video: https://www.youtube.com/watch?v=QSF8JXFPR18
And for some reason, js is not displayed in my browser console.
I tried it on Opera and Chrome.
Everywhere is the same (blank)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
WapSter, 2021-06-21
@Lucius13


In your code, only the last element will be written. console.log works fine

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question