Constants are block-scoped, much like variables defined using the let statement. The value of a
constantcannot change through re-assignment, and it can't beredeclared.
As per MDN The value of a constant cannot change through re-assignment, and it can't be redeclared, so inside of for...in and for...of how is working?
const data = ['A', 'B', 'C', 'D'];
//Here const key is changed
for (const key in data) {
console.log('key ',key);
}
//Here const value is changed
for (const value of data) {
console.log('value ',value);
}