If you want to ensure that an object is converted into an array of objects, you can use the following approach:
typescript Copy code const car = { model: 'RAV4', brand: 'Toyota' };
const table = [].concat(car);
console.log(table); // Output: [{ model: 'RAV4', brand: 'Toyota' }] Why Use This Approach? This method is useful when you're uncertain whether you’re dealing with an object or an array of objects. Using [].concat(object) ensures the result is always an array.