Uso de propiedad de longitud
const fruits = ['Apple', 'Orange', 'Strawberry'];
fruits.length = 2;
console.log(fruits); // [ 'Apple', 'Orange' ]
Code language: JavaScript (javascript)
Dijana Lazic