13 lines
365 B
Markdown
13 lines
365 B
Markdown
|
---
|
||
|
title: Manipulate Arrays With unshift()
|
||
|
localeTitle: Manipular matrices con unshift ()
|
||
|
---
|
||
|
## Manipular matrices con unshift ()
|
||
|
|
||
|
Mientras `push()` agrega elementos a la parte posterior de la matriz, `unshift()` agrega al frente. Todo lo que tienes que hacer es:
|
||
|
|
||
|
```javascript
|
||
|
var arr = [2, 3, 4, 5];
|
||
|
arr.unshift(1); // Now, the array has 1 in the front
|
||
|
|
||
|
```
|