I am doing The Odin Project JavaScript exercises and have been struggling with exercise 4 for over a week.
This is my function:
const removeFromArray = function (...args) {
let normalArray = args;
normalArray.splice(2, 1);
return normalArray;
}
removeFromArray(1, 2, 3, 4)
returns [1, 2, 4]
The exercise test expects it toEqual to [1, 2, 4]. That is exactly what I get when I run the code in Firefox.
When I run the code in Visual Studio Code through npm, the test fails.