JSFiddle - React, Tailwind, and code Playground

by Elak

JavaScript

(function(){
    var items = [];
    items.push(1,2,3,4,5,6);
    var index = items.length;
    console.log(index); // 6
    index >= items.length && (index = 0);
    console.log(index); // 0
    index = 1;
    index >= items.length && (index = 0);
    console.log(index); // 1
})();