// Quick way
a = ['A','B','C','D'];
console.log(a.length); // 4
a.length = 3;
console.log(a); // ['A', 'B', 'C'];
// Proper way
function resize(arr, newSize, defaultValue) {
return [ ...arr, ...Array(Math.max(newSize - arr.length, 0)).fill(defaultValue)];
}