Functional Programming: Refactor Global Variables Out of Functions

I am lost with this lesson. I know I am doing something wrong but what?

// the global variable
var bookList = ["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"];

/* This function should add a book to the list and return the list */
// New parameters should come before bookName

// Add your code below this line
let copyBookList = arr; //Which led to indexOf not a function
let copyBookList = [...arr] //This finally let me pass my tests
  // Add your code above this line
}

/* This function should remove a book from the list and return the list */
// New parameters should come before the bookName one

// Add your code below this line

function add (bookName) {
bookList.push("bookName");
}

function remove (bookName) {
bookList.pop("bookName");
}


    // Add your code above this line
    }
}

var newBookList = add(bookList, 'A Brief History of Time');
var newerBookList = remove(bookList, 'On The Electrodynamics of Moving Bodies');
var newestBookList = remove(add(bookList, 'A Brief History of Time'), 'On The Electrodynamics of Moving Bodies');

console.log(bookList);

add and remove are both missing a parameter; they should take a list of books as the first parameter and return that list once it’s been modified.

What you’re now doing is altering the global variable bookList. This the main point of the exercise: you absolutely cannot modify that.

You’ve also completely altered the logic for remove: what happens if the book you want to remove from the list is not the last one?