Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #19644

Re: variable access

Message-ID <1629412.iLo1Md9sQa@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Organization PointedEars Software (PES)
Date 2013-05-06 01:09 +0200
Subject Re: variable access
Newsgroups comp.lang.javascript
References <90af5a5a-ba92-4745-917c-a8ad3ff54704@googlegroups.com> <51863ea9$0$6640$9b4e6d93@newsspool2.arcor-online.net> <c56b3a60-c211-4bf5-8e67-fdf1789fb5e8@googlegroups.com> <5148182.RP0mX05cp1@PointedEars.de>

Show all headers | View raw


Thomas 'PointedEars' Lahn wrote:

> saurabh.khemka4@gmail.com wrote:
>> Suppose I have a variable declared in javascript file(1.js)
>> 
>> game = "abc";
> 
> This is _not_ a variable declaration.  A variable declaration starts with
> 
>   var
> 
> followed by the variable identifier, and an optional initialization part.
> 
> You are attempting to add a property named “game” to an object, which, by
> contrast to a variable declaration, can fail even if syntactically
> correct.
> 
> For example, if there is an element with name or ID “abc” in your
                                           ^^^^^^^^^^^^^^^^
I meant name or ID “game”, of course.  The left-hand side of the simple 
assignment specifies name of the property whose value may not be modifiable.

> document, and you are using IE/MSHTML, this assignment *will* fail because
> the global object or another object before it in the scope chain already
> has a non- writable property of that name that refers to the corresponding
> object.

-- 
PointedEars

Twitter: @PointedEars2
Please do not Cc: me. / Bitte keine Kopien per E-Mail.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

variable access saurabh.khemka4@gmail.com - 2013-05-05 03:19 -0700
  Re: variable access Martin Honnen <mahotrash@yahoo.de> - 2013-05-05 13:12 +0200
    Re: variable access saurabh.khemka4@gmail.com - 2013-05-05 05:48 -0700
      Re: variable access saurabh.khemka4@gmail.com - 2013-05-05 07:44 -0700
        Re: variable access "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-05-05 17:30 +0200
      Re: variable access Stanimir Stamenkov <s7an10@netscape.net> - 2013-05-05 19:39 +0300
      Re: variable access Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-05 19:47 +0200
        Re: variable access Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-06 01:09 +0200

csiph-web