Codington
0 of 10 problems solved • 0%
Use in a course

Exercise prompt

Build Discounted Prices

A loop can build a new array by pushing one calculated result for every input value.

Example

const doubled = []; for (const number of [1, 2]) { doubled.push(number * 2); }

Your task

Complete the loop so discountedPrices contains each original price minus 2. Keep prices unchanged and display both arrays.