JavaScript error on setTimeout

Hello i have created a slide images with JavaScript and slider it works, but it always show an error on Console Log that you can see on image below.
Code of JavaScript is on codepen https://codepen.io/beh4r/pen/RdeZGz
Screenshot_1

prevBtn = document.querySelector('.img-left'),

This is the line that is causing the error I see. Your Codepen does not have any elements in the HTML section and so the querySelector returns null, because there are no elements with the class=“img-left”. Can you post your HTML in your codepen?

yeah here it is

slide is not a function. You need to supply a function as the first argument to setTimeout.

Can you explain what you are trying to accomplish with the last two lines of the for loop?

    clearTimeout(timer);
    timer = setTimeout(slide, 1000);

i totally forgot why i added the timeout function there.
In another modal silder i made a slider with images that automatically changes images,
but looks like i added the wrong function there so i deleted setTimeout and finally error is not showing, thanks for finding my error :slight_smile: