JSFiddle - React, Tailwind, and code Playground
JavaScript
var attributes = ["a","b","c","d"];
var a = [1,2,3];
var b = [34,55,66];
var c = [22,23,53];
var d = [15,78,98];
var arr = [];
//since this is not node, I have to emulate the global scope
var global={a:a,b:b,c:c,d:d};
while(true){
var obj = {};
for(var i=0;i<attributes.length;i++){
if(global[attributes[i]].length)obj[attributes[i]]=global[attributes[i]].shift();
}
if(Object.keys(obj).length)
arr.push(obj);
else
break;
}
console.log(arr);