In and Out explainer


The aim of this puzzle: Complete the price function so that it returns the .price property of the item.

Walkthrough of the solution: An arrow function can work like a normal function, with input parameters and a return value. Inside the parentheses (), you add the names of the parameters that the function will use. The priceOf function should take an item and then return its price, so it has 1 parameter which we can call item.

To make the function output the price, we need to add the return keyword between the curly brackets {}. The value that should be returned is the .price property of the item. That looks like return item.price

Sample code solution:
(Tap below to reveal)

import { groceries } from '';

let nameOf = (item) => {
let priceOf = (item) => {
  return item.price;


JavaScript Concepts: Array Indexing, Code Block (arrow function), console.log()


This text will be hidden