Path: csiph.com!weretis.net!feeder4.news.weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: Thomas 'PointedEars' Lahn Newsgroups: comp.lang.javascript Subject: Re: convert a string into a json object, Date: Sat, 02 Apr 2016 04:07:31 +0200 Organization: PointedEars Software (PES) Lines: 24 Message-ID: <2542125.XVB1Yskezl@PointedEars.de> References: <87d1q9qfyr.fsf@bsb.me.uk> Reply-To: Thomas 'PointedEars' Lahn Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Trace: solani.org 1459562852 26937 eJwNxsEBwCAIA8CVJJgA47Qo+4/Q3uvoMnVsUZvDOTVpgbwGtSHfjPXfn2XoSo03mwd3xkvoDwoAEKk= (2 Apr 2016 02:07:32 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Sat, 2 Apr 2016 02:07:32 +0000 (UTC) User-Agent: KNode/4.14.2 X-User-ID: eJwNwoERwCAIBLCVRPhHxwGE/UdoL4FSWG4EDYNp4fGpvh0WGltlxcrS3omTroG6OJZPCuxf+bs6lUGfmfwAa00Wtg== Cancel-Lock: sha1:w7Z6GQISOlg+WAsSaiK94grH+sw= X-NNTP-Posting-Host: eJwFwQEBwCAMAzBLjNFulQM/9S+BBMngV4vgguFQTJNdQv0+a1uZLO9s9mhLF71PaorjEg8IMxBH Xref: csiph.com comp.lang.javascript:30182 Ben Bacarisse wrote: > John Harris writes: >> The code contained >> const result = {}; >> and >> result[i]= person; >> >> The constant result is not what I would call a constant. You've >> updated it. > > const makes the binding immutable, the object isn't. Neither is the value as it is updated on each iteration. This code should break; ECMAScript got it wrong. Rule of thumb of good programming: Do not write code in a way that is harder to understand. -- PointedEars FAQ: | SVN: Twitter: @PointedEars2 | ES Matrix: Please do not cc me. / Bitte keine Kopien per E-Mail.