Answers for "Get specific elements from an object by using filter method"

0

Get specific elements from an object by using filter method

const products = [
    { name: 'Laptop', price: 32000, brand: 'Lenovo', color: 'Silver' },
    { name: 'Phone', price: 700, brand: 'Iphone', color: 'Golden' },
    { name: 'Watch', price: 3000, brand: 'Casio', color: 'Yellow' },
    { name: 'Aunglass', price: 300, brand: 'Ribon', color: 'Blue' },
    { name: 'Camera', price: 9000, brand: 'Lenovo', color: 'Gray' },
];
const getProduct = products.filter(product => product.name.includes('t'));
console.log(getProduct)
//Expected output:
/*
[
  { name: 'Laptop', price: 32000, brand: 'Lenovo', color: 'Silver' },
  { name: 'Watch', price: 3000, brand: 'Casio', color: 'Yellow' }
]
*/
Posted by: Guest on September-11-2021

Code answers related to "Get specific elements from an object by using filter method"

Code answers related to "Javascript"

Browse Popular Code Answers by Language