Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
9f60b54
Topic about splice translated
adriavieira314 Feb 19, 2020
b545120
Minor changes on spelling
adriavieira314 Feb 19, 2020
3682d91
Slice method translated
adriavieira314 Feb 19, 2020
a515f5e
Minor changes in spelling
adriavieira314 Feb 19, 2020
d5e89d4
Minor changes in spelling
adriavieira314 Feb 19, 2020
0fbf0ab
Method concat translated
adriavieira314 Feb 19, 2020
001de77
ForEach method translated
adriavieira314 Feb 19, 2020
b754cce
Searching in Arrays translated
adriavieira314 Feb 19, 2020
01f5aeb
Filter, map and sort methods translated
Feb 20, 2020
7313e2a
Filter, map, sort, reverse, split and join methods translated
Feb 21, 2020
0de0510
Reduce method translated
Feb 21, 2020
709683d
Minor changes
Feb 21, 2020
0769724
Minor changes
Feb 21, 2020
4e22c2e
Array.isArray translated
Feb 22, 2020
9184f6c
Minor spelling changes
Feb 22, 2020
588b6e9
Summary translated
Feb 22, 2020
ce7ce92
Minor spelling changes
Feb 22, 2020
8a4a64c
Links changed to articles in portuguese
Feb 23, 2020
56545f4
Minor spelling changes
Feb 23, 2020
bba9814
solution.js translated
Feb 23, 2020
4e5f6b6
task camelcase translated
Feb 23, 2020
3c92031
Task filter range translated
Feb 23, 2020
c938a34
Task filter-range-in-place translated
Feb 23, 2020
0d4eebb
Task sort translated
Feb 23, 2020
2283adc
Task copy-and-sort translated
Feb 23, 2020
1570319
Task array-get-names translated
Feb 23, 2020
7cf4aa1
Task calculator translated
Feb 23, 2020
49cc586
Map objects task translated
Feb 23, 2020
10014f4
sort-objects task translated
Feb 23, 2020
dfaaada
minor spelling changes
Feb 23, 2020
b464660
shuffle task translated
Feb 23, 2020
04c309e
average-age task translated
Feb 23, 2020
be3a6e4
array-unique task translated
Feb 23, 2020
e654190
Titles from tasks translated
Feb 23, 2020
af4e20f
Merge branch 'master' into master
gabifs Dec 6, 2025
9d014ef
Apply suggestions from code review
gabifs Dec 6, 2025
79c2d79
Apply suggestions from code review
gabifs Dec 6, 2025
9c03478
Apply suggestions from code review
gabifs Dec 6, 2025
4b5ba30
Apply suggestion from @gabifs
gabifs Dec 6, 2025
def0a09
Apply suggestion from @gabifs
gabifs Dec 6, 2025
1eff808
Update 1-js/05-data-types/05-array-methods/article.md
gabifs Dec 6, 2025
a620b9b
Apply suggestions from code review
gabifs Dec 6, 2025
902720d
Apply suggestion from @gabifs
gabifs Dec 6, 2025
f43933b
Apply suggestions from code review
gabifs Dec 6, 2025
2cd18a6
Apply suggestions from code review
gabifs Dec 6, 2025
1dde270
Apply suggestions from code review
gabifs Dec 6, 2025
219bee6
Update 1-js/05-data-types/05-array-methods/article.md
gabifs Dec 6, 2025
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
Method concat translated
  • Loading branch information
adriavieira314 committed Feb 19, 2020
commit 0fbf0abda67bd6f878cf907d55a0ed55e22d9fbf
38 changes: 19 additions & 19 deletions 1-js/05-data-types/05-array-methods/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,64 +141,64 @@ alert( arr.slice(-2) ); // s,t

### concat

The method [arr.concat](mdn:js/Array/concat) joins the array with other arrays and/or items.
O método [arr.concat](mdn:js/Array/concat) une um array com outros arrays e/ou itens.

The syntax is:
Sua sintaxe é:

```js
arr.concat(arg1, arg2...)
```

It accepts any number of arguments -- either arrays or values.
Este método aceita qualquer número de argumentos -- sendo arrays ou valores.

The result is a new array containing items from `arr`, then `arg1`, `arg2` etc.
O resultado vai ser um novo array contendo itens do `arr`, e também do `arg1`, `arg2` etc.

If an argument is an array or has `Symbol.isConcatSpreadable` property, then all its elements are copied. Otherwise, the argument itself is copied.
Se o argumento for um array ou possuir a propriedade `Symbol.isConcatSpreadable`, então todos seus elementos são copiados. Caso contrário, o argumento em si é copiado.

For instance:
Veja o exemplo:

```js run
let arr = [1, 2];

// merge arr with [3,4]
// une arr com [3,4]
alert( arr.concat([3, 4])); // 1,2,3,4

// merge arr with [3,4] and [5,6]
// une arr com [3,4] e [5,6]
alert( arr.concat([3, 4], [5, 6])); // 1,2,3,4,5,6

// merge arr with [3,4], then add values 5 and 6
// une arr com [3,4], e então adiciona os valores 5 e 6
alert( arr.concat([3, 4], 5, 6)); // 1,2,3,4,5,6
```

Normally, it only copies elements from arrays ("spreads" them). Other objects, even if they look like arrays, added as a whole:
Normalmente, ele somente copia elementos de um array. Outros objetos, mesmo que eles se pareçam com arrays, são adicionados como um todo:

```js run
let arr = [1, 2];

let arrayLike = {
0: "something",
let exemploDeArray = {
0: "algo",
length: 1
};

alert( arr.concat(arrayLike) ); // 1,2,[object Object]
//[1, 2, arrayLike]
alert( arr.concat(exemploDeArray) ); // 1,2,[objeto Objeto]
//[1, 2, exemploDeArray] copiou a array em vez de seus elementos armazenados
```

...But if an array-like object has `Symbol.isConcatSpreadable` property, then its elements are added instead:
...Mas se um array parecido com um objeto possui a propriedade `Symbol.isConcatSpreadable`, então os seus elementos são adicionados:

```js run
let arr = [1, 2];

let arrayLike = {
0: "something",
1: "else",
let exemploDeArray = {
0: "qualquer",
1: "coisa",
*!*
[Symbol.isConcatSpreadable]: true,
*/!*
length: 2
};

alert( arr.concat(arrayLike) ); // 1,2,something,else
alert( arr.concat(exemploDeArray) ); // 1,2,qualquer,coisa
```

## Iterate: forEach
Expand Down