In Reverse explainer


The aim of this puzzle: Sort the groceries array from highest to lowest price.

Walkthrough of the solution: When the starter code runs, it prints out all of the grocery items. The order of items increases in price. To reverse the order of the array, you can use the .reverse() method.

Attach .reverse() to groceries before printing the array.

Sample code solution:
(Tap below to reveal)

import { groceries } from '';
function printItem(item) {
  console.log( + ': $' + item.price);

JavaScript Concepts: Binary Expression (+ concatenation), console.log(), .forEach(), import, .reverse()