Slide img addEventListener

Hello, eveyone,
I’m trying to find a way to take away the onclick on the HTML and have it on the vanilla js when the user clicks on the image prev and next, how can i do it ? with maybe and addEventListener to each one of them. The links both have a function called plusDivs(1), and plusDivs(-1), that will read the var slideIndex = 1;
I have the source code in codepen wait until images load, thanks.

<a href="#"  onclick="plusDivs(-1)">left</a>
 <a href="#"  onclick="plusDivs(1)">right</a>