Path: csiph.com!xmission!news.snarked.org!border2.nntp.dca1.giganews.com!nntp.giganews.com!buffer2.nntp.dca1.giganews.com!buffer1.nntp.dca1.giganews.com!nntp.westnet.com.au!news.westnet.com.au.POSTED!not-for-mail NNTP-Posting-Date: Thu, 12 Dec 2019 03:36:12 -0600 Subject: Re: object giving errors Newsgroups: comp.lang.javascript References: <6f346103-79d8-44bb-a4a7-28ef1615d784@googlegroups.com> From: Andrew Poulos Date: Thu, 12 Dec 2019 20:36:02 +1100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.3.0 MIME-Version: 1.0 In-Reply-To: <6f346103-79d8-44bb-a4a7-28ef1615d784@googlegroups.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-AU Content-Transfer-Encoding: 7bit Message-ID: <7aidnc1N1teRl2_AnZ2dnUU7-R2dnZ2d@westnet.com.au> Lines: 35 X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 60.241.30.10 X-Trace: sv3-Yc418HANk8MqwdEutau5s5+9xEvEqIAUCPcdsFicc57rJ0KSul+3LOhRs9KqqV/gmrsO/VxEBbjVVPo!yX8GE3SufubQOeZO0jXMkrQ+arcDG6d3oE0KGtFbbiEhmmWhyIrFwAbwzTkwQdD+QuhDcho+J+A9!C7yOYYv4s4sBI24aoC0= X-Complaints-To: abuse@westnet.com.au X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 2029 Xref: csiph.com comp.lang.javascript:37956 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