Returning array.push()

Hello fellow coders!

I’m halfway through the Redux course and I can’t understand the difference between:

return arr;


return arr.push();

I mean, aren’t these approaches the same? I accept the fact that the latter does not work properly (apparently it does not return the array with the pushed value at the end of it), but I need to know why! hahahaha.

Thank you so much.

.push() doesn’t return an array. It returns the new length of the array after pushing.

1 Like

Oh! I see…the answer was in front of me the whole time on MDN. Thank you for taking your time to answer me.

Sorry about the stupid question.