Tell us what’s happening:
On the challenge: https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/functional-programming/refactor-global-variables-out-of-functions
There is this function I wrote. This works…
function add (arr, bookName) {
let listOfBooks = [...arr];
listOfBooks.push(bookName);
return listOfBooks;
// Add your code above this line
}
but previously I wrote:
return listOfBooks.push(bookName);
and that wasnt working.
I did not understand the difference between the two.
Could anyone help me with that?
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:63.0) Gecko/20100101 Firefox/63.0
.
**Link to the challenge:**https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/functional-programming/refactor-global-variables-out-of-functions