Merge pull request #772 from 11un/patch-9-fix-indent

add sum-salaries solution with fixed indentation
This commit is contained in:
Ilya Kantor 2019-02-01 22:33:51 +03:00 committed by GitHub
commit c4ecba5f64
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -0,0 +1,14 @@
```js run
function sumSalaries(salaries) {
let sum = 0;
for (let salary of Object.values(salaries)) {
sum += salary;
}
return sum; // 650
}
```
Or, optionally, we could also get the sum using `Object.values` and `reduce`:
`Object.values(salaries).reduce((a, b) => a + b) // 650`