2

I'm very much new to JavaScript. This question may be something very primitive. The posts that are suggested when I was typing this question didn't help me to resolve the issue.

I was following a tutorial and it uses Google Chrome console for exercises. It showed that the global and window objects tables could be printed on the console.

I tried and window was printed but not the global object. Why is this? Do I need to upgrade to a certain version of chrome/install other plugin to support global variables?

It says "Global is not defined"

enter image description here

3
  • 2
    "I was following a tutorial" — a link would be useful so that we could tell if this was an error in the tutorial or if you misunderstood something about it. Commented Jan 15, 2017 at 22:45
  • Thanks! It's a vedio tutorial udemy.com/programming-in-javascript. There is a section on "The global object" Commented Jan 15, 2017 at 22:51
  • Oh I went through it again. It asks me to run the browser in "incognito mode". I don't know what was that but it resolved the issue. Thanks for pointing me back to the tutorial again :) Commented Jan 15, 2017 at 23:01

3 Answers 3

3

I think I found the answer to the question.

The Chrome browser has to be in the "Incognito mode" to see the global object.

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

-1

What do you mean by global variables? If you define a variable "var x = 0" Outside of any functions it's global and can be called anywhere.

Including in the console.

1 Comment

Sorry my mistake. it's not variable, it's global object.
-1

Have you perhaps run across a NodeJS tutorial where global is used to create a global variable outside of a module?

https://nodejs.org/api/globals.html#globals_global

This is not valid in browser JavaScript, even though in NodeJS it is still JavaScript, the global stuff is a little different.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.