Possible Bug in js curriculum

Hi there, I’m working on the Javascript curriculum and this Challenge:


following code will pass the test even though the original array bookList is modified. Can someone confirm?

// 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(bookList, bookName) {

  return [...bookList, bookName]
  // Change code above this line

// Change code below this line
function remove(bookList, bookName) {
  const book_index = bookList.indexOf(bookName);
  if (book_index >= 0) {

    bookList.splice(book_index, 1);
    return bookList;

    // Change code above this line

// console.log(bookList)
// console.log(remove(bookList, "The Hound of the Baskervilles"))
// console.log(bookList)

Fixing the test would be a great challenge for me :wink:

Yeah, it looks like we need to update the first test to include something along the lines of

remove(bookList, "On The Electrodynamics of Moving Bodies") should not change bookList.

Thank you for helping make FCC better. Bugs can be reported as GitHub Issues. Whenever reporting a bug, please check first that there isn’t already an issue for it and provide as much detail as possible.

Issue created. Thanks

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.