Mark As Completed Discussion

Are you sure you're getting this? Fill in the missing part by typing it in.

What line would get us the max profit for each day?

SNIPPET
1const prices = [ 10, 7, 6, 2, 9, 4 ];
2let curMax = prices[prices.length - 1];
3let maxProfit = 0;
4for (let i = prices.length - 1; i >= 0; i--) {
5	const temp = prices[i];
6	______________
7		curMax = temp;
8	}
9	const curProfit = curMax - temp;
10	if (curProfit > maxProfit) {
11		maxProfit = curProfit;
12	}
13}
14console.log(maxProfit);

Write the missing line below.