How to make up the number of arrays with empty arrays

 test = 
   [
        ["qwe","1"],
        ["ewq","2"],
        ["aaa","4"],
    ]


I want to keep the number of arrays at four, fill in the empty array if there is a gap, and fill in according to the numbers in the array, but where to fill in

finish filling like this

 test = 
       [
            ["qwe","1"],
            ["ewq","2"],
            ["",""],
            ["aaa","4"],
        ]
        
        

how do I achieve this requirement?

Jun.18,2022

let test = [
            ["qwe", "1"],
            ["ewq", "2"],
            ["aaa", "4"],
        ]

        function setArr(test) {
            for (let i = 0; i < test.length; iPP) {
                const item = test[i];
                if (i + 1 != item[1]) {
                    test.splice(i, 0, ['', ''])
                }
            }
            return test
        }

        console.log(setArr(test))

test.reduce((acc, cur, i) => {
  while (cur[1] - 1 != i) {
    acc.push(['', '']);
    iPP
  }
  acc.push(cur);
  return acc;
}, [])

the premise defaults that the original array is in sequential order (1, 2, 3.) Arranged

Menu