Refactor a transformation loop
The loop creates a new array by applying the same calculation to every price.
const prices = [10, 20, 30];
const discounted = [];
for (const price of prices) {
discounted.push(price * 0.9);
}
Choose an array operation that expresses the transformation and keeps the original array unchanged.
Which refactor returns the same discounted values in the same order?
Why it matters: Array transformations are easier to scan when each operation has one clear purpose.