derived state

10 = 1 + 2 + 3 + 4

Notes:

The total is derived from the array.

The array is a state variable. The total is a derived variable.

We use the .reduce() array method to launch a callback function that adds each value in the array.