From 6e22dcb8c2a6e9d0bad3abb79039d4c161cd354e Mon Sep 17 00:00:00 2001 From: trissiswaifu <86461023+trissiswaifu@users.noreply.github.com> Date: Fri, 8 Apr 2022 23:14:02 -0500 Subject: [PATCH] Update 05 (Day 5) - Fix Splice Examples The Splice examples do not work as intended. When you console.log it does not show the correct values. You must perform the splice on a previous line and then output the array that has been spliced. --- 05_Day_Arrays/05_day_arrays.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/05_Day_Arrays/05_day_arrays.md b/05_Day_Arrays/05_day_arrays.md index d0a8307..8ff987b 100644 --- a/05_Day_Arrays/05_day_arrays.md +++ b/05_Day_Arrays/05_day_arrays.md @@ -521,19 +521,21 @@ Splice: It takes three parameters:Starting position, number of times to be remov ```js const numbers = [1, 2, 3, 4, 5] - - console.log(numbers.splice()) // -> remove all items + numbers.splice() + console.log(numbers) // -> remove all items ``` ```js const numbers = [1, 2, 3, 4, 5] - console.log(numbers.splice(0,1)) // remove the first item + numbers.splice(0,1) + console.log(numbers) // remove the first item ``` ```js - 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 + const numbers = [1, 2, 3, 4, 5, 6] + numbers.splice(3, 3, 7, 8, 9) + console.log(numbers) // -> [1, 2, 3, 7, 8, 9] //it removes three item and replace three items ``` #### Adding item to an array using push