Why it always returns me 4?

Why it always returns me 4?
0.0 0

#1

function test(a, b) {
c = a.push(b);
return c;
}
var myArray = [1, 2, 3];
var item = 5;
test(myArray, item);


#2

Hi 9jat,
Are you trying to push item into myArray? If that’s the case then you don’t need a new variable c. All you need to do is push b into a and return a. I’ve blurred the solution below in case you want to give it a shot first.

function test(a, b) {
a.push(b);
return a;
}
var myArray = [1, 2, 3];
var item = 5;
test(myArray, item);