2018-10-12 15:37:13 -04:00
|
|
|
---
|
|
|
|
title: Modify Array Data With Indexes
|
|
|
|
---
|
2019-07-24 00:59:27 -07:00
|
|
|
# Modify Array Data With Indexes
|
2018-10-12 15:37:13 -04:00
|
|
|
|
2019-07-24 00:59:27 -07:00
|
|
|
|
|
|
|
---
|
|
|
|
## Hints
|
|
|
|
|
|
|
|
### Hint 1
|
2018-10-12 15:37:13 -04:00
|
|
|
Access the position of the array, and change it, like so:
|
|
|
|
|
|
|
|
```javascript
|
|
|
|
var arr = [1, 2, 3, 4, 5];
|
2019-07-24 00:59:27 -07:00
|
|
|
|
2018-10-12 15:37:13 -04:00
|
|
|
arr[0] = 6; // Now, the array is [6, 2, 3, 4, 5]
|
2019-07-24 00:59:27 -07:00
|
|
|
arr[4] = 10; // Now, the array is [6, 2, 3, 4, 10]
|
2018-10-12 15:37:13 -04:00
|
|
|
```
|
|
|
|
|
|
|
|
The important concept here is that arrays are **mutable**. This means that they can be changed easily.
|