pull/804/merge
ambarish35 3 months ago committed by GitHub
commit d3102dc65e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -522,7 +522,7 @@ Splice: It takes three parameters:Starting position, number of times to be remov
```js ```js
const numbers = [1, 2, 3, 4, 5] const numbers = [1, 2, 3, 4, 5]
numbers.splice() numbers.splice()
console.log(numbers) // -> remove all items console.log(numbers) // -> doesn't remove any item
``` ```
@ -535,7 +535,7 @@ Splice: It takes three parameters:Starting position, number of times to be remov
```js ```js
const numbers = [1, 2, 3, 4, 5, 6] const numbers = [1, 2, 3, 4, 5, 6]
numbers.splice(3, 3, 7, 8, 9) numbers.splice(3, 3, 7, 8, 9)
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)) // -> [1, 2, 3, 7, 8, 9] //it removes three item from index 3 and adds three items
``` ```
#### Adding item to an array using push #### Adding item to an array using push

Loading…
Cancel
Save