Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8541077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:44:51+00:00 2026-06-11T11:44:51+00:00

I was reading the following analysis from David Mark about the js framework Sencha:

  • 0

I was reading the following analysis from David Mark about the js framework “Sencha”: https://gist.github.com/3279190 and in there he states…

What they wanted was a global variable, but they ended up with is a property of the Global Object. According the specifications and (and implementation history) there are enough differences between the two that care is required not to mix them up (as is done here).

…but as far as I was aware there wasn’t any difference between var my_global = 123; and (in a browser environment) window.my_global = 123; (in that example I assumed the environment was a browser – hence the use of window, but I could have just used this.my_global instead as obviously the Global Object would be different when run in different environments).

But ignoring that minor discrepancy is there a difference between assigning a property to the Global Object and creating a global variable? I thought not, and that creating a global variable was just another way to assign a property to the Global Object.

I believe there can be an issue in some browsers if they had an element with an id of “my_global” then apparently that can cause problems with JavaScript referencing the right thing, but I’m not sure how/what causes that problem (e.g. does assigning a property to the Global Object cause the element id issue to occur, or is it declaring a global variable that causes the element id issue?)

Can someone clarify this for me please?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T11:44:52+00:00Added an answer on June 11, 2026 at 11:44 am

    Update, April 2020

    As noted in the comments by D. Pardal, the first sentence below, written in 2012, is no longer always true in environments that support ES Modules (spec). Inside an ES module, a var statement does not produce a property of the global object.

    Original answer

    A variable created using var in the global scope does create a property of the global object. However, this property has different behaviour from a property of the global object that has not been created using var.

    Firstly, there is a difference in how a variable declaration is executed: a var statement in the global scope creates a property of the global object before any code is executed, an effect commonly known as hoisting, well documented around the web (see references below).

    Secondly, the global variable, unlike a property of the global object that has not been created with var, cannot be deleted using the delete operator (although this is not true in older versions of IE). delete cannot be used to delete variables. This difference is down to internal property attributes that every object property has. These attributes are specified in the ECMAScript specification. In ECMAScript 5 terms, var foo = "bar" creates a property foo of the global object with the [[Configurable]] attribute false whereas this.foo = "bar" (in global scope) creates a foo property with [[Configurable]] attribute true.

    References:

    • Dmitry Soshnikov has written at length about this in his excellent
      series of articles, ECMAScript 262-3 in detail. I recommend
      reading all of chapter 2, but the most relevant section is called
      About Variables.

    • The kangax article linked earlier contains a lot of
      relevant information and details of browser bugs and deviations,
      plus further quirks concerning window.

    • Angus Croll’s Variables vs. Properties in JavaScript article, which links to many of the same resources as this answer.

    • The spec: ECMAScript 5.1.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was reading the following blogs about ASP.Net Async pages http://msdn.microsoft.com/en-us/magazine/cc163725.aspx http://world.episerver.com/Blogs/Magnus-Rahl/Dates/2012/1/Async-Pages-part-3-Async-Pages-with-databinding-and-events/ And a
I'm reading the following about UIScrollView from Apple UIScrollView Class Reference Documentation: Because a
I've been reading the following: http://developer.android.com/guide/practices/screens_support.html It's about the folders res-long-land-hdpi , res-notlong-land-dpi ,
I was reading the following text from Stanford's Programming Paradigms class , and I
I’ve recently started learning IOCP on Windows and been reading the following article: http://www.codeproject.com/Tips/95363/Another-TCP-echo-server-using-IOCP
am reading out of a database with the following python script: cur.execute(SELECT * FROM
I have the following example of reading from a buffered reader: while ((inputLine =
Recently I was reading the following piece of code from oracle collection tutorial when
I was reading the following article: http://java.sun.com/docs/hotspot/gc1.4.2/example.html and have trouble understanding the following lines:
I am reading the following article, http://articles.sitepoint.com/article/hierarchical-data-database/2 aboutStoring Hierarchical Data in a Database. This

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.