Chunky Monkey Question abpit array.push()

Chunky Monkey Question abpit array.push()
0.0 0

#1

I have a question about array.push() method.

Can someone explain the difference in these two lines of code.
//Line 1:
// testArr = myArray.push(arr.slice(i,(size+i)));

//Line 2:     
  testArr.push(arr.slice(i, (size+i)));

Link to Code:

I tried numerous different ways to come to the solution but just stumbled onto the answer almost by accident.


#2

.push returns the new length of the modified array after pushing.

In line 1, testArr has the value of myArray's updated size.
In line 2, testArr is modified to have a new element as it’s last value.