'How can I loop through an array one by one when a button is clicked

I want to be able to loop over an array one by one when the next button is clicked. I have a code in place but it only goes to the next one and then sticks to that.

<div class="template-in-conversation">
    <a data-video-id="1" data-video-time="0">video1</a>
    <a data-video-id="2" data-video-time="200">video1</a>
    <a data-video-id="3 data-video-time="367">video1</a>
</div>
$(".next-btn").click(function() {
    const wistiaEl = $(".template-in-conversation a");
    const wistiaIdArray = [];
    const wistiaTimeArray = [];
    let arrayCount = 0;
    
    wistiaEl.each(function(){
        const wisitiaID = $(this).data("video-id");
        const wistiaTime = $(this).data("video-time");
        wistiaIdArray.push(wisitiaID);
        wistiaTimeArray.push(wistiaTime);
    });           

    console.log(wistiaIdArray[arrayCount++]);
    console.log(wistiaTimeArray[arrayCount++]);


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source