I have learned somewhere that variables declared using const
throw error when reassigned. But inside a loop it works just fine.
For example;
for(let i=0; i<allItems.length; i++){
const item = allItems[i]
item.innerText = "Yayy"
}
This works fine, and does not throws error, eventhough item is reassigned multiple times. Can someone clarify why this happens.