const str = 'i have learned something new today';
const arr = str.split(" ");
for (var i = 0; i < arr.length; i++) {
arr[i] = arr[i].charAt(0).toUpperCase() + arr[i].slice(1);
}
const str2 = arr.join(" ");
console.log(str2);
Above is a simple loop but i did'nt get this arr[i] part of the code and i need a deeper understanding for it.
when the code says “array[i]” it is referring to the for loop var “i”. So then the for loop is checking to see if the value of “i” is greater than the value of the var called “largest”. As soon as “i” is greater than largest, the value of largest gets set to that number.
Above is the explanation i get from the search but i am not satisfied with it?