const arr = ['a','b','c'];
for (let char of arr) {
console.log(char);
}
I believe that time complexity of code above is O(n).
const arr = ['a','b','c'];
for (let char of arr) {
console.log(arr.indexOf(char);
}
However, does indexOf() search all the elements?
If does so, I believe time complexity of code above may be O(n^2)
I want to know whether indexOf() searches all the components as for loop.