freeCodeCamp/guide/spanish/certifications/javascript-algorithms-and-d.../basic-javascript/manipulate-arrays-with-unshift/index.md

13 lines
365 B
Markdown
Raw Normal View History

2018-10-12 19:37:13 +00:00
---
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
```