i have a array of array like below.
const array1 = [[8,1,2,3,1],[3,1,1,1],[4,2,1]];
what i need to do is append six empty values " " in-between last two values for each element.
Expected output:
[ [ 8, 1, 2, '', '', '', '', '', '', 3, 1 ],
[ 3, 1 '', '', '', '', '', '' , 1, 1,],
[ 4, '', '', '', '', '', '', 2, 1 ] ]
What i tried:
i know how to append this to end of each element like below. can I modify my code with adding positioning? What is the most efficient way to do this?
const array1 = [[8,1,2,3,1],[3,1,1,1],[4,2,1]];
const appendArray = new Array(6).fill('');
const map1 = array1.map(x => x.concat(appendArray));
console.log(map1)

.splice