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


Groups > comp.lang.javascript > #37956

Re: object giving errors

Subject Re: object giving errors
Newsgroups comp.lang.javascript
References <h5Cdnb0TscbyZWzAnZ2dnUU7-f3NnZ2d@westnet.com.au> <6f346103-79d8-44bb-a4a7-28ef1615d784@googlegroups.com>
From Andrew Poulos <ap_prog@hotmail.com>
Date 2019-12-12 20:36 +1100
Message-ID <7aidnc1N1teRl2_AnZ2dnUU7-R2dnZ2d@westnet.com.au> (permalink)

Show all headers | View raw


On 12/12/2019 7:31 pm, Julio Di Egidio wrote:
> On Thursday, 12 December 2019 09:21:15 UTC+1, Andrew Poulos  wrote:
>> Why is it that when I do this
>>
>> function pos() {
>>     return { "top": 10, "left": l20 };
>> }
>>
>> or this
>>
>> function pos() {
>>     let o = { "top": 10, "left": l20 };
>>     return o;
>> }
>>
>> I get "Uncaught ReferenceError: l20 is not defined".
>>
>> But when I do it like this
>>
>> function pos() {
>>     let o = {};
>>     o.top = 10;
>>     o.left = 120;
>>     return o;
>> }
>>
>> I get no errors?
> 
> l20 is just not the same as 120...
> 
> Haven't yet had your coffee yet?

Oh my, I've been looking at for ages and I couldn't work out what was wrong.

Andrew Poulos

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


Thread

object giving errors Andrew Poulos <ap_prog@hotmail.com> - 2019-12-12 19:20 +1100
  Re: object giving errors Julio Di Egidio <julio@diegidio.name> - 2019-12-12 00:31 -0800
    Re: object giving errors Andrew Poulos <ap_prog@hotmail.com> - 2019-12-12 20:36 +1100
  Re: object giving errors Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2019-12-12 10:11 +0100
    Re: object giving errors Andrew Poulos <ap_prog@hotmail.com> - 2019-12-12 20:38 +1100
      Re: object giving errors Julio Di Egidio <julio@diegidio.name> - 2019-12-12 02:21 -0800
  Re: object giving errors "R.Wieser" <address@not.available> - 2019-12-14 17:24 +0100

csiph-web