Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Challenge: Discovering Featured Products | Advanced Array Operations
course content

Contenido del Curso

JavaScript Data Structures

Challenge: Discovering Featured ProductsChallenge: Discovering Featured Products

Task

  1. The original array is given as products, containing objects representing products with properties name, price, and featured.
  2. Use the find() method to discover the first product in the array with the featured property set to true.
  3. If a featured product is found, log its name and price; otherwise, log a message indicating that no featured product was found.

Expected output:

  1. Use the find() method on the products array and provide a callback function that checks if the featured property of the product object is true.
  2. If a featured product is found, log its name and price; otherwise, log a message indicating that no featured product was found.

¿Todo estuvo claro?

Sección 5. Capítulo 6
course content

Contenido del Curso

JavaScript Data Structures

Challenge: Discovering Featured ProductsChallenge: Discovering Featured Products

Task

  1. The original array is given as products, containing objects representing products with properties name, price, and featured.
  2. Use the find() method to discover the first product in the array with the featured property set to true.
  3. If a featured product is found, log its name and price; otherwise, log a message indicating that no featured product was found.

Expected output:

  1. Use the find() method on the products array and provide a callback function that checks if the featured property of the product object is true.
  2. If a featured product is found, log its name and price; otherwise, log a message indicating that no featured product was found.

¿Todo estuvo claro?

Sección 5. Capítulo 6
some-alt