Javascript global scope with const vs var

Viewed 156
var name = 'John';

console.log(this.name, document.name, window.name, name);

const meme = "Bruce";

console.log(this.meme, document.meme, window.meme, meme);

Output:

John undefined John John
undefined undefined undefined "Bruce"

Is global scope differently defined for var and const? I thought the only difference would be the const is immutable.

1 Answers
Related