I was working on my solution and I got very close to Solution 1. However, I was not getting the correct result because I was using ‘i’ in the for loop and not ‘a’.
Can someone explain to me why we use ‘a’ and not ‘i’?

I understand the function in sort() can be any other characters (so say, (d,e) and it would sort the same and then we return d), just wondering if anyone can point me in the right direction, to a reference for understanding this.

function getIndexToIns(arr, num) {
arr.sort(function(a, b) { return a - b;});
for (var a = 0; a < arr.length; a++) {
if (arr[a] >= num) return a;
}
return arr.length;
}

Except instead of ‘a’ I was using ‘i’.
So the problem is solved. I just don’t understand fundamentally why we use ‘a’ and not ‘i’

no, i understand why we use ‘i’ and how that can also be any character. i dont know why im struggling to grasp why we use ‘a’ in the for loop, same letter as the function in sort. why MUST those letters be the same.

Sorry if this question is silly. I’m just really trying to UNDERSTAND JavaScript fully. not just get the cert.

and by the way, yes in my code I use let and var, but thank you.