Created
September 11, 2022 09:37
-
-
Save buymed-hoangpham/d4172cab2757509560b349d0c0e7f34e to your computer and use it in GitHub Desktop.
7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const trips = [ | |
| { to: 'Brazil', distance: 1000 }, | |
| { to: 'Chine', distance: 2500 }, | |
| { to: 'India', distance: 3000 }, | |
| ]; | |
| const totalDistanceTraveled = trips.reduce( | |
| (sum, cur) => (sum += cur.distance), | |
| 0 | |
| ); | |
| console.log( | |
| '🚀 ~ file: index.js ~ line 11 ~ totalDistanceTraveled ~ totalDistanceTraveled', | |
| totalDistanceTraveled | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment