freeCodeCamp/guide/portuguese/javascript/standard-objects/array/array-of/index.md

27 lines
708 B
Markdown
Raw Normal View History

---
title: Array of
localeTitle: Matriz de
---
## Matriz de
O método Array.of () cria uma nova ocorrência de Array com um número variável de argumentos, independentemente do número ou tipo dos argumentos.
Sintaxe:
```javascript
Array.of(element0[, element1[, ...[, elementN]]])
```
## Exemplo
```javascript
Array.of(7); // [7] - creates an array with a single element
Array.of(1, 2, 3); // [1, 2, 3]
Array(7); // [ , , , , , , ] - creates an empty array with a length property of 7
Array(1, 2, 3); // [1, 2, 3]
```
#### Mais Informações:
Para mais informações, visite [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/of)