JSFiddle - React, Tailwind, and code Playground

by ocanal

HTML

<div></div>

JavaScript

jQuery.fn.eachTwo = function(fn)
{
    var self = this;
    return this.each(function(key, el)
    {
        if (self.hasOwnProperty(key+1))
            fn.call(this,self[key],self[key+1],el)
    });
};



var row = [ "one", "two", "three", "four", "five", "six" ];

$(row).eachTwo(function(i,j){
    console.log(i+" "+j);
});