Tell us what’s happening:
**Your code so far**
function nonMutatingPush(original, newItem) {
// Only change code below this line
return (newItem.reduce(function (x,y) {
return x.concat(y)
}, original))
// return original.push(newItem);
// Only change code above this line
}
var first = [1, 2, 3];
var second = [4, 5];
nonMutatingPush(first, second);
So far I was trying to use reduce and FCC compiler giving me the error
Your code should not use the **push** method.
Can someone explain to me why it’s saying like that?
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36
.
Challenge: Add Elements to the End of an Array Using concat Instead of push
Link to the challenge: