1) No alteres una variable u objeto: crea nuevas variables y objetos y devuélvelos, si es necesario, desde una función. Pista: usar algo como `const newArr = arrVar`, donde `arrVar` es un arreglo, simplemente creará una referencia a la variable existente y no una copia. Así que cambiar un valor en `newArr` cambiaría el valor en `arrVar`.
2) Declara parámetros de función: cualquier cálculo dentro de una función depende sólo de los argumentos pasados a la función y no en ningún objeto o variable global.
Reescribe el código para que el arreglo global `bookList` no sea cambiado dentro de ninguna de las funciones. La función `add` debe agregar el `bookName` dado al final del arreglo pasado a esta y devolver un nuevo arreglo (lista). La función `remove` debe eliminar el `bookName` dado del arreglo pasado a esta.
`bookList` no debe cambiar y aún ser igual a `["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"]`.
`add(bookList, "A Brief History of Time")` debe devolver `["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae", "A Brief History of Time"]`.
`remove(bookList, "On The Electrodynamics of Moving Bodies")` debe devolver `["The Hound of the Baskervilles", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"]`.
`remove(add(bookList, "A Brief History of Time"), "On The Electrodynamics of Moving Bodies");` debe ser igual a `["The Hound of the Baskervilles", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae", "A Brief History of Time"]`.
const bookList = ["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"];
const bookList = ["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"];