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