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


Groups > comp.lang.javascript > #23598

Re: Declaring global variables

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!ecngs!feeder2.ecngs.de!217.188.199.168.MISMATCH!takemy.news.telefonica.de!telefonica.de!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail
Content-Type text/plain; charset="UTF-8"
Message-ID <139484623.PyJ8SnIKrL@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Reply-To Thomas 'PointedEars' Lahn <cljs@PointedEars.de>
Organization PointedEars Software (PES)
Date Fri, 14 Mar 2014 01:08:25 +0100
User-Agent KNode/4.11.5
Content-Transfer-Encoding 8Bit
X-Face %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&.<b';Md8`dH6iqhT)6C^.Px|[=M@7=Ik[_w<%n1Up"LPQNu2m8|L!/3iby{-]A+#YE}Kl{Cw$\U!kD%K}\2jz"QQP6Uqr],./"?;=4v
Face iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEXTxa4RFk5dUWANED8PFEfy7+MGBiW+n3ZNF/QuAAACaElEQVQ4jVXUwVOcMBQG8Dc7Rc4PUntdWV2uxjDpGaGeozOp1woar4jd5t/v9wLstMwsA/ntlxdCAgUc1hjTc9/JCZfGoo3wG3HdmdAWrIJRHe7GM/TmpY5VFefuVcAkkPbLIaN8rmPmjloyZxgyR3GuJ4K0AGtJ2htz8o7yqikm759fldQXaMpbDzjKAG+8v+AugVTOPO5DOjLvGtUYQwh0CPjnVMyGd+8/GfUB5nLKJDD2aLDh5HYyMDJGDwQIo2ZmZcKbowNmAdB/AzyFhrmF2MHRb0QJJfaAnwGB6orZhoykLzJtGwF/xpYxI1dswomiUj3gTuAIqCn/4C7cULwGNBtwMTk3Y4LfKB5YUaOKBKYtpplm7u0vip8tU1NWWyI/7XdcSuIDoMt6rVHMWT0DbjHPGqDqZVSa6zleLcUTcIKLoMv3ueJluALtAo9B302zPPlrtiVScRdCjXvVh3e3JpYa/jjkuC9N+LrBMlz/eAN4eQijX2EdLo6c5tGGHwLyHFtXk89dDGHwCVhG9T0S/j55AhRZgkMCmUQXJ49TnS1wnQDvw0eAh9ICeMmEFbCnPMFzjAvsWoEWEFdYEx+S0MoUZ1gT1wId8+AF3Bl2OoEu906AUHx5VLw/gXYg/x84loOah/2UYNrgiwSwGO7RfUzVBbx/kgpckumGOi6QirtD6gkLTitbnxNol47S2jVc2vsN5kPqaAHT8uUdAJM4v/DanjYOwmUjWznGfwB7sGtAtor5BgofDuzaRj4kSQAqDakTsKORa3Q3xKi3gE1fhl71KRMqrdZ2AWNNg/YOhQyrVBnb+i+nEg4bsDA+egAAAABJRU5ErkJggg==
Subject Re: Declaring global variables
Newsgroups comp.lang.javascript
References <6ae3i9h0e63li3380f0s84pi8h6uque0t3@4ax.com> <property-20140313151743@ram.dialup.fu-berlin.de>
MIME-Version 1.0
Lines 23
NNTP-Posting-Date 14 Mar 2014 01:08:29 CET
NNTP-Posting-Host e7689280.newsspool1.arcor-online.net
X-Trace DXC=W_OR4[mGY:@=8m7nZkdN^@ic==]BZ:afN4Fo<]lROoRAnkgeX?EC@@@:B3KFXJVReBDZm8W4\YJNLYUVHKH;GI^Gb2AEPH863SNNY_d;0fc0?D
X-Complaints-To usenet-abuse@arcor.de
Xref csiph.com comp.lang.javascript:23598

Show key headers only | View raw


Stefan Ram wrote:

> "Joey@still_Learning.invalid" <Joey@still_Learning.invalid> writes:
>> This seems to work, but adding the 'var' prefix throws an error, i.e.,
>> 'var window.variable = value' throws "Syntax error while loading:
>> expected ';', got '.'"
> 
>   »var« declares a (new) /variable/.
> 
>   »window.variable =« adds a /property/ to the window object,
>   or sets the value of a window property.

A very important difference indeed.  Many newcomers think the “window” 
property is a built-in identical to the global object when it is in fact a 
host-defined context-dependent property referring to a host object that 
happens to be in the scope chain in that host environment for historical 
reasons.

-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix>
Please do not Cc: me. / Bitte keine Kopien per E-Mail.

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


Thread

Declaring global variables "Joey@still_Learning.invalid" <Joey@still_Learning.invalid> - 2014-03-13 07:04 -0700
  Re: Declaring global variables "Joey@still_Learning.invalid" <Joey@still_Learning.invalid> - 2014-03-13 07:39 -0700
    Re: Declaring global variables Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2014-03-13 16:15 -0300
      Re: Declaring global variables "Joey@still_Learning.invalid" <Joey@still_Learning.invalid> - 2014-03-13 14:30 -0700
        Re: Declaring global variables Denis McMahon <denismfmcmahon@gmail.com> - 2014-03-13 23:12 +0000
          Re: Declaring global variables "Joey@still_Learning.invalid" <Joey@still_Learning.invalid> - 2014-03-13 16:53 -0700
  Re: Declaring global variables Martin Honnen <mahotrash@yahoo.de> - 2014-03-13 16:15 +0100
  Re: Declaring global variables Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-03-14 01:08 +0100
    Re: Declaring global variables JJ <duh@nah.meh> - 2014-03-14 09:46 +0700
      Re: Declaring global variables Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2014-03-14 07:03 -0300

csiph-web