JSFiddle - React, Tailwind, and code Playground

JavaScript

a=[
[1,6,6,8,1], 

[7,3,2,6],


[7,3,2]

] 

var max = Math.max.apply(null, a.map(function(i) { return i.length; }));
var new_arr = a.map(function(i) {
var pad = max - i.length;
while (pad--) {
    i.push(0);
}
    return i;
});

console.log(new_arr);