I have an array consists 50 items.
I want to wrap every 3 items to a <div>.
I'm cracking my head trying to achieve this but I can't get it to work
var cards = [];
for(var i=0; i < 50; i++){
    cards.push('<div class="card-item">Test</div>');
}
for(var i = 0; i < cards.length; i++){
    if(i % 3 === 0){
        let slides = populateSlide(cards[i]);
        console.log(slides);
    }
}
populateSlide = (cards) => {
    return `<div class="carousel-item item">${cards}</div>`;
}
Using the code above, I only managed to get a single item in every multiply of 3. Hence my div only has single item instead of three.
Thanks in advance.
 
     
     
     
    