Challenges 5 exercises
Problem

Narrowing with an Array

In this exercise, we will review a couple things we learned about identity functions.

This wrapFruit function takes an array of fruits, each with a name and a price, and returns an object with a getFruit function. The getFruit function takes in the fruit name and returns the fruit object that matches the name:

Loading exercise