Skip to content

Commit bef0496

Browse files
committed
1-js/05-data-types/05-array-methods/
Ru translation: task 1 and 2 have translated
1 parent 7f4147a commit bef0496

5 files changed

Lines changed: 21 additions & 21 deletions

File tree

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
function camelize(str) {
22
return str
3-
.split('-') // splits 'my-long-word' into array ['my', 'long', 'word']
3+
.split('-') // разбить 'my-long-word' на массив ['my', 'long', 'word']
44
.map(
5-
// capitalizes first letters of all array items except the first one
6-
// converts ['my', 'long', 'word'] into ['my', 'Long', 'Word']
5+
// преобразовать все, кроме первой буквы в массиве на большую
6+
// из ['my', 'long', 'word'] в ['my', 'Long', 'Word']
77
(word, index) => index == 0 ? word : word[0].toUpperCase() + word.slice(1)
88
)
9-
.join(''); // joins ['my', 'Long', 'Word'] into 'myLongWord'
9+
.join(''); // соеденить ['my', 'Long', 'Word'] в 'myLongWord'
1010
}
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
importance: 5
1+
важность: 5
22

33
---
44

5-
# Translate border-left-width to borderLeftWidth
5+
# Перевести текст вида border-left-width в borderLeftWidth
66

7-
Write the function `camelize(str)` that changes dash-separated words like "my-short-string" into camel-cased "myShortString".
7+
Напишите функцию `camelize(str)` которая преобразует строки вида "my-short-string" в "myShortString".
88

9-
That is: removes all dashes, each word after dash becomes uppercased.
9+
То есть, дефисы удаляются, а все слова после них получают заглавную букву.
1010

11-
Examples:
11+
Например:
1212

1313
```js
1414
camelize("background-color") == 'backgroundColor';
1515
camelize("list-style-image") == 'listStyleImage';
1616
camelize("-webkit-transition") == 'WebkitTransition';
1717
```
1818

19-
P.S. Hint: use `split` to split the string into an array, transform it and `join` back.
19+
P.S. Подсказка: используйте `split` чтобы разбить строку на массив символов, потом переделайте всё как нужно и методом `join` соедините обратно.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
```js run demo
22
function filterRange(arr, a, b) {
3-
// added brackets around the expression for better readability
3+
// добавлины скобки вокруг выражения для улучшения читабельности
44
return arr.filter(item => (a <= item && item <= b));
55
}
66

77
let arr = [5, 3, 8, 1];
88

99
let filtered = filterRange(arr, 1, 4);
1010

11-
alert( filtered ); // 3,1 (matching values)
11+
alert( filtered ); // 3,1 (совпадающие значения)
1212

13-
alert( arr ); // 5,3,8,1 (not modified)
13+
alert( arr ); // 5,3,8,1 (не изменён)
1414
```
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
importance: 4
1+
важность: 4
22

33
---
44

5-
# Filter range
5+
# Фильтрация по диапазону
66

7-
Write a function `filterRange(arr, a, b)` that gets an array `arr`, looks for elements between `a` and `b` in it and returns an array of them.
7+
Напишите функцию `filterRange(arr, a, b)` которая принимает массив `arr`, ищет в нём элементы между `a` и `b` и отдаёт массив этих элементов.
88

9-
The function should not modify the array. It should return the new array.
9+
Функция должна возвращать новый массив и не изменять исходный.
1010

11-
For instance:
11+
Например:
1212

1313
```js
1414
let arr = [5, 3, 8, 1];
1515

1616
let filtered = filterRange(arr, 1, 4);
1717

18-
alert( filtered ); // 3,1 (matching values)
18+
alert( filtered ); // 3,1 (совпадающие значения)
1919

20-
alert( arr ); // 5,3,8,1 (not modified)
20+
alert( arr ); // 5,3,8,1 (не изменён)
2121
```
2222

1-js/05-data-types/05-array-methods/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -734,4 +734,4 @@ alert(youngerUsers.length); // 2
734734

735735
Поближе ознакомьтесь со шпаргалкой представленной выше, а затем, чтобы попрактиковаться, решите задачи предложенные в данной главе. Так вы получите необходимый опыт в правильном использовании методов массива.
736736

737-
Всякий раз, когда вам нужно что-то сделать с массивом, и вы не знаете, как это сделать -- приходите сюда, посмотрите на таблицу и найдите правильный метод. Примеры помогут вам всё сделать правильно и вскоре вы автоматически запомните методы без особых усилий с вашей стороны.
737+
Всякий раз, когда вам нужно что-то сделать с массивом, и вы не знаете, как это сделать -- приходите сюда, посмотрите на таблицу и найдите правильный метод. Примеры помогут вам всё сделать правильно и вскоре вы автоматически запомните методы без особых усилий с вашей стороны.

0 commit comments

Comments
 (0)