Could you please help me figure out this algorithm without using splice:
Write a program that inserts a new number A at an index B. For example, if array = [1, 3, 5, 7] and A = 10 and B = 2, by the end of your program, array should be [1, 3, 10, 5, 7].
My thinking is that I would loop through the array, and then replace A with B, but it's not quite right:
for(var i = 0; i < arr.length; i++) {
arr[2] = 10;
}