|
|
@ -799,7 +799,8 @@ console.log(numbers.splice(0, 1)) // remove the first item
|
|
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
```js
|
|
|
|
const numbers = [1, 2, 3, 4, 5, 6]
|
|
|
|
const numbers = [1, 2, 3, 4, 5, 6]
|
|
|
|
console.log(numbers.splice(3, 3, 7, 8, 9)) // -> [1, 2, 3, 7, 8, 9] //it removes three item and replace three items
|
|
|
|
console.log(numbers.splice(3, 3, 7, 8, 9)) // -> [4, 5, 6] here it shows the removed items
|
|
|
|
|
|
|
|
console.log(numbers) // -> [1, 2, 3, 7, 8, 9] //it removes three item and replace three items
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
##### Adding item to an array using push
|
|
|
|
##### Adding item to an array using push
|
|
|
|