Sure. If you take a look at the console, your newArr for the first example ([1, 4]) is logging as [1, 2, 3, 4, undefined] – and adding undefined in your reduce function seems to be returning NaN (or a “not a number” error).
In order to debug this, I changed the last line (where you return newArr.reduce(...)), and broke it apart:
let returnValue = newArr.reduce(...);
console.log(returnValue);
return(returnValue);
This allowed me to see what you’re actually returning. In this case, you’re returning “NaN”.