Skip to content

Tasks done #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add exercises description
  • Loading branch information
tshemsedinov committed Oct 15, 2019
commit bebe19a84c4baa9ec3904128b3fd6659a4f95dc4
47 changes: 47 additions & 0 deletions Exercises.ru.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Упражнения

## Итерирование циклами

Руализуйте функцию `sum(...args)`, которая суммирует все свои аргументы, пятью
разными способами. Примеры вызовов с результатами:
```js
const a = sum(1, 2, 3) // a === 6
const b = sum(0) // b === 0
const c = sum() // c === 0
const d = sum(1, -1, 1) // d === 1
const e = sum(10, -1, -1, -1) // e === 7
```

1. Цикл `for`
2. Цикл `for..of`
3. Цикл `while`
4. Цикл `do..while`
5. Метод `Array.prototype.reduce()`

## Итерирование по двумерному массиву

6. Найдите максимальный элемент в двумерном массиве
```js
const m = max([[1, 2, 3], [4, 5, 6], [7, 8, 9]]);
console.log(m); // 9
```

## Итерирование объектов-справочников

7. При помощи цикла `for..in` перебрать объект-справочник с датами рождения и
смерти людей и вернуть справочник с продолжительностью их жизни. Например:
```js
const persons = {
lenin: { born: 1870, died: 1924 },
mao: { born: 1893, died: 1976 },
gandhi: { born: 1869, died: 1948 },
hirohito: { born: 1901, died: 1989 },
};
console.log(ages(persons));
// {
// lenin: 54,
// mao: 83,
// gandhi: 79,
// hirohito: 88,
// }
```