how does find works in javscript 3f

Solutions on MaxInterview for how does find works in javscript 3f by the best coders in the world

showing results for - "how does find works in javscript 3f"
Gael
24 Mar 2019
1const products = [
2    { name: 'Laptop', price: 32000, brand: 'Lenovo', color: 'Silver' },
3    { name: 'Phone', price: 700, brand: 'Iphone', color: 'Golden' },
4    { name: 'Watch', price: 3000, brand: 'Casio', color: 'Yellow' },
5    { name: 'Aunglass', price: 300, brand: 'Ribon', color: 'Blue' },
6    { name: 'Camera', price: 9000, brand: 'Lenovo', color: 'Gray' },
7];
8//Get product that price is greater than 3000 by using a find
9const getProduct = products.find(product => product.price > 3000);
10console.log(getProduct) //first conditon will be print
11//Expected output:
12/* { name: 'Laptop', price: 32000, brand: 'Lenovo', color: 'Silver' } */