My question is related to: “Basic Algorithm Scripting: Where do I Belong”, but not really a question about the problem.
I was wondering why my code is returning a “3” instead of [40,60,50] or even [40,60],50. Why is it counting the length of arr and num?
My code.
function getIndexToIns(arr, num) {
let newarr= arr.push(num)
console.log(newarr)
return newarr;
}
getIndexToIns([40, 60], 50);
Thanks in advance!