Whenever you call a function, it will be evaluated. So before you chain functions together you need to know what they evaluate to, what they return.
You can read it in there what this function returns:
“Return value: The new length property of the object upon which the method was called.”
So, the function push returns the length of the new array. If you had the following array:
let array = ["a","b","c"]
and you did
array.push("d"), this call to “push” will evaluate to “4”, because that’s the length of the new array, and what the function “push” returns, you see?
So what you’re doing with arr.push evaluates to a number.
Arr.push(num) is equal to the length of Arr, not to Arr itself.
Arr.push(num).sort() is equal to
When in doubt, just type in
console.log(arr.push(num)), that will show you what arr.push turns into and if that is really what you wanted to write.