Hello, i don’t really need help but i struggled a bit at this exercice.

To do the exercice you have to know how slice() work when doing a copy (called shallow copy) of an array passed in a function argument.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice

```
/*
Link: https://beta.freecodecamp.org/en/challenges/functional-programming/refactor-global-variables-out-of-functions
*/
// the global variable
var bookList = ["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"];
//function add a book to the array
function add( bookList, bookName ) {
//make a copy of the argument's array
let bookListCopy = bookList.slice(0);
//add the bookName to the new array
bookListCopy.push( bookName );
//return the new modified array
return bookListCopy;
};
//function remove a book from the array
function remove( bookList, bookName ) {
//make a copy of the argument's array
let bookListCopy = bookList.slice(0);
if( bookListCopy.indexOf( bookName ) >= 0 ) {
//delet the book
bookListCopy.splice( bookListCopy.indexOf( bookName ), 1 );
//return the new modified array
return bookListCopy;
}
};
//create a new array from an already existing one but with a new bookName in it
var newBookList = add( bookList, 'A Brief History of Time' );
//create a new array from an already existing one but with a deleted bookName from it
var newerBookList = remove( bookList, 'On The Electrodynamics of Moving Bodies' );
//remove from the bookList at which we added 'A Brief History of Time', the bookName 'On The Electrodynamics of Moving Bodies'
var newestBookList = remove( newBookList, 'On The Electrodynamics of Moving Bodies' );
//["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"];
console.log( bookList );
//["The Hound of the Baskervilles", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"]
console.log( newerBookList );
//["The Hound of the Baskervilles", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae", "A Brief History of Time"]
console.log( newestBookList );
```

I hope it can help you and save you some time.