This commit is contained in:
Ilya Kantor 2016-07-31 00:28:27 +03:00
parent 9064e35f3f
commit 4c531b5ae7
371 changed files with 338 additions and 316 deletions

View file

@ -0,0 +1,16 @@
```js run
let salaries = {
John: 100,
Ann: 160,
Pete: 130
}
let sum = 0;
for(let key in salaries) {
sum += salaries[key];
}
alert(sum); // 390
```

View file

@ -0,0 +1,19 @@
importance: 5
---
# Sum object properties
We have an object storing salaries of our team:
```js
let salaries = {
John: 100,
Ann: 160,
Pete: 130
}
```
Write the code to sum all salaries and store in the variable `sum`. Should be `390` in the example above.
If `salaries` is empty, then the result must be `0`.