Global Object "Window" JavaScript heeeelllllpppppp!


#1

Ok so i took this off the MDN doc for Global Object

“A global object is an object that always exists in the global scope”. In JavaScript, there’s always a global object defined" …???

and my question is WHERE?? Do you have to create it or is it just there but we can’t see it??


#2

https://developer.mozilla.org/en-US/docs/Web/API/Window


#3

mtf im sorry, i’m still learning, could you just explain it in simple terms to me what it is please. I only started with Codecademy a year ago. I can make sense of that doc you sent and i have been stuck on this definition of “Window” for a day and a half now and still dont get it


#4

A global variable, window , representing the window in which the script is running, is exposed to JavaScript code.

Not to be confused with Window since window is only one part of the interface. For our purposes (HTML, CSS and JS) the only one that concerns us the window variable.

My question now is, what is it that led up to this question in the first place? Seems a might bit advanced for a beginner to be treading over.


#5

I have worked my way through every lesson since may 2017. If you have the Codecademy curriculum handy, take a look. I stated with html, CSS, Flexbox, Responsive Design ,Box Model, Functions, Arrays, Loops, Iterators etc i am not a beginner in that regard but when dealing with Objects I AM because i only started Objects a few weeks ago.


#6

mtf okay so firstly when i first posted my question, i asked about a Global OB JECT “window” not a Global VARIABLE “window”


#7

For our purposes, window is the top of the scope chain. We don’t even have to specify it unless we have shadowed a global variable inside a function and still need to access it.

{
  var a = 42;
  function foo() {
    var a = 7, b = 6;
    return a * b === window.a;
  }
  console.log(foo());    // true
}

window is the variable that references the object. It is not the object.

Window.window


#8

im going to enroll on a course , maybe a bootcamp to finish this, i can’t work like this. I need proper explanation so and practice the code so it get it. I’m not gona do it here. Sorry. Thanks for your help


#9

You still have not given your question any context. What brings up this question?

BTW… Hover over Window.window link above and read the tooltip.