The global context === window
for CSCI E3, Harvard University author(s): Larry Bouthillier
by DustyWhite
HTML
<div>
<p>Everything is part of an object: the Global context </p>
<p>If we delcare a variable or a function in the global context, it doesn't appear to be part of an object. Turns out, the global context, in the browser, is actually the <code>window</code> object.</p>
<p></p>
<p>Open the console to see the output.</p>
</div>
CSS
#output{
width:80%;
border: 1px solid black;
padding: 1em;
}
JavaScript
var school = "Harvard";
console.log(`school is ${school}`); // Harvard
console.log(`window.school is ${window.school}`); // Harvard
console.log(window);