Tell us what’s happening:
Ok… so to be honest I would have been stunned if my “work so far” had been sufficient to accomplish the task…
my grasp of the concepts laid out in front of me has felt a little weak since i started this chapter…
I have been waiting for the moment where i would have to post
WHAT AM I MISSING… conceptually… not just help me towards the answer… if i may be so bold as to ask… can someone point out what are the holes… making my “thought boat” all leakkkyy hahaha
idk really how to ask this…
Your code so far
// The global variable
const bookList = ["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"];
// Change code below this line
function add(book) {
book = bookName
let bookList1 = bookList
bookList1.push(book);
return bookList1;
// Change code above this line
}
// Change code below this line
function remove(book) {
const book_index = bookList1.indexOf(book);
if (book_index >= 0) {
bookList1.splice(book_index, 1);
return bookList1;
// Change code above this line
}
}
Your browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36
Challenge: Functional Programming - Refactor Global Variables Out of Functions
Link to the challenge: