Why is
for (var i in window) {
console.log(i);
}
interpreted differently from
for (var i in window) {
console.log(window[i]);
}
?
When I ran the first script, I got the window object's properties (https://www.w3schools.com/jsref/obj_window.asp) and its methods. However, when I ran the second script, I got the window's objects and functions. Why is console.log(i)
different from console.log(window[i])
?