Generation

generate functionThu, 13 Apr 2023

hacer un query param limit de productos que sea igual que el largo del array

const products = [ { id: 1, name: 'Laptop', price: 50000 }, { id: 2, name: 'Mouse', price: 2000 }, { id: 3, name: 'Headphones', price: 6000 }, { id: 4, name: 'Pen', price: 500 } ]; function getProducts(products, limit) { return products.slice(0, limit); } getProducts(products, 2);

Javascript
Generate More

Questions about programming?Chat with your personal AI assistant