Having problems closing brackets

I am very sorry for this noob question, but my js file shows 5 errors, but all my brackets seem closed.

can anyone help plase

MY JS FILE:

const targets = [...document.getElementsByName('item-id')];

const lazyLoad = target => {
          const io = new IntersectionObserver((entries, observer) => {
            entries.forEach(entry => {
    
        
              if (entry.isIntersecting) {
                entry.addEventListener("click", function(event){
                    const clickedId = event.target.value
                    const clickedBtn = document.getElementById(`like-unlike-${clickedId}`)
            
                    $.ajax({
                        type: 'POST',
                        url: "/like-unlike/",
                        data: {
                            'csrfmiddlewaretoken': csrftoken,
                            'item-id': clickedId,
                        },
                        success: function(response){
                            console.log(response.likes)
                            clickedBtn.textContent = `${response.likes} likes`
                            
                        },
                        error: function(error){
                            console.log(error)
                        }
                    })
                }));
        
                observer.disconnect();
              })
            })
          })
        
          io.observe(target);
        }
        
targets.forEach(lazyLoad);

is this supposed to be inside the addEventListener section?

It might be a good idea to add some comments to the closing brackets like

} //end if (entry..)

You should look into using a code editor that has the ability to properly indent your code.

See below for properly indented code. You should be able to see the issue quickly.

const targets = [...document.getElementsByName('item-id')];

const lazyLoad = target => {
const io = new IntersectionObserver((entries, observer) => {
  entries.forEach(entry => {


    if (entry.isIntersecting) {
      entry.addEventListener("click", function(event) {
        const clickedId = event.target.value
        const clickedBtn = document.getElementById(`like-unlike-${clickedId}`)

        $.ajax({
          type: 'POST',
          url: "/like-unlike/",
          data: {
            'csrfmiddlewaretoken': csrftoken,
            'item-id': clickedId,
          },
          success: function(response) {
            console.log(response.likes)
            clickedBtn.textContent = `${response.likes} likes`

          },
          error: function(error) {
            console.log(error)
          }
        })
      }));

    observer.disconnect();
  })
})
})

io.observe(target);
}

targets.forEach(lazyLoad);