if i use for in, i always use const to declare variable
const array = ["a","b","c"]
for (const value in array) {
console.log(value);
}
but the other way is use global scope variable using let
let value
const array = ["a","b","c"]
for (value in array) {
console.log(value);
}
the result is same, but i don’t know which way is better. Could you explain the difference between the above two methods in terms of memory or cost?
the result is same, but i don’t know which way is better. Could you explain the difference between the above two methods in terms of memory or other cost?