I am making a simple slideshow in js and want to make a fade function that can be implemented easily with this code that i'm using right now.
var pics = [pics]
var btn = document.querySelector("button");
var img = document.querySelector("img");
var counter = 1;
btn.addEventListener("click", function(){
if(counter === 5)
{
counter = 0;
}
img.src = pics[counter]
counter = counter + 1; });