Skip to content

Update Project_1.js#1

Open
Boogloo wants to merge 1 commit intoPacktPublishing:mainfrom
Boogloo:patch-1
Open

Update Project_1.js#1
Boogloo wants to merge 1 commit intoPacktPublishing:mainfrom
Boogloo:patch-1

Conversation

@Boogloo
Copy link

@Boogloo Boogloo commented Apr 3, 2022

Used splice() in the code

Used splice()
@GiXhnu
Copy link

GiXhnu commented Oct 15, 2023

The steps described by the author gives the result:
Screenshot from 2023-10-15 12-43-54

But author says to manipulate your array using various methods, such as pop(), push(), shift(), and unshift().
My method to make this happen is :

const theList = ['Laurence', 'Svekis', true, 35, null, undefined,
{test: 'one', score: 55}, ['one', 'two']];

theList.pop(); 
theList.pop(); 
theList.pop(); 
theList.pop(); 
theList.shift(); 
theList.unshift("FIRST"); 
theList[3] = "hello World"; 
theList[2] = "MIDDLE"; 
theList.push("LAST"); 
console.log(theList);

Results in :
Screenshot from 2023-10-15 12-50-41

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants