Skip to content

Commit 3c92031

Browse files
author
Adria Vieira
committed
Task filter range translated
1 parent 4e5f6b6 commit 3c92031

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

22
function filterRange(arr, a, b) {
3-
// added brackets around the expression for better readability
3+
// colchetes adicionado ao redor da expressão para melhor entendimento
44
return arr.filter(item => (a <= item && item <= b));
55
}
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+
// colchetes adicionado ao redor da expressão para melhor entendimento
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 (valores que coincidem com o que foi pedido)
1212

13-
alert( arr ); // 5,3,8,1 (not modified)
13+
alert( arr ); // 5,3,8,1 (array não foi modificada)
1414
```

1-js/05-data-types/05-array-methods/2-filter-range/task.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@ importance: 4
44

55
# Filter range
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+
Escreva uma função `filterRange(arr, a, b)` que pegue um array `arr`, procure por elementos entre `a` e `b` e retorne um array novo com os elementos encontrados.
88

9-
The function should not modify the array. It should return the new array.
9+
A função não deve modificar o array. Deve retornar um novo array.
1010

11-
For instance:
11+
Exemplo:
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 (valores que coincidem com o que foi pedido)
1919

20-
alert( arr ); // 5,3,8,1 (not modified)
20+
alert( arr ); // 5,3,8,1 (array não foi modificada)
2121
```
2222

0 commit comments

Comments
 (0)