Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const arrayTest = [
- {name: 'Silver', experience: 10},
- {name: 'Kevin', experience: 5},
- {name: 'Happy', experience: 1},
- {name: 'Xan', experience: 1}
- ]
- let sum = 0;
- function total(experience) {
- return sum += experience
- }
- arrayTest.forEach(el => total(el.experience))
- console.log(sum)
Add Comment
Please, Sign In to add comment