(js) What is the [i] used for in the for loop?

Hey, so this solution is probably already out there but I don’t know where to find it so ima post bout it here. I am talking about the I after nums. Thanks

for(var i in nums){
	totalSum += nums[i]

Hi, welcome to the FCC forum.

This is shorthand: for(var i in nums){
for this: for (var i = 0; i < nums.length; i++){
The i is the same counter variable/index as in the regular for loop.

I recommend always using for..of and never using for..in unless you specifically need the indexes. And forget C-style for-loops even exist.