Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #30194
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Scott Sauyet <scott@sauyet.com> |
| Newsgroups | comp.lang.javascript |
| Subject | Re: convert a string into a json object, |
| Date | Sat, 2 Apr 2016 20:30:06 -0000 (UTC) |
| Organization | A noiseless patient Spider |
| Lines | 38 |
| Message-ID | <ndpa4e$gce$1@dont-email.me> (permalink) |
| References | <c8134afb-b7f5-4e2d-b3e6-90f8a3594544@googlegroups.com> <json-20160401033220@ram.dialup.fu-berlin.de> <ndlcms$ae5$1@news.albasani.net> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 8bit |
| Injection-Date | Sat, 2 Apr 2016 20:30:06 -0000 (UTC) |
| Injection-Info | mx02.eternal-september.org; posting-host="9f5796507d456582385410b6c955cc7f"; logging-data="16782"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+eVrF0cQX9sLVT3x2ddjvmynPTYcY0fGw=" |
| User-Agent | Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2) |
| Cancel-Lock | sha1:hyamJGR5+8otRvLXZXbCa2egvsU= |
| Xref | csiph.com comp.lang.javascript:30194 |
Show key headers only | View raw
Stefan Weiss wrote:
> Off-topic... does anymody else find it counter-intuitive when most of
> the variables are declared as "const"? I've seen this style recently in
> many places, and it's technically correct, but for some reason I find it
> irritating.
No, I don't find it so any longer. I did for a time, though. I think it
was the years of working in Javascript with only function-level scoping
(well, and global, of course) that makes it feel really wrong to see
something listed as `const` in a repeated block-scope.
But I've grown to like it. So long as I don't try to think of it as the
definition of a constant (which can be tempting) it works well.
I like the distinction between:
let myMutableRef = -1, i = 0;
while(i < something) {
myMutableRef = someFunc(i);
doSomething(myMutableRef);
i++;
}
and
let i = 0;
while (i < something) {
const myImmutableRef = someFunc(i);
doSomething(myImmutableRef);
i++;
}
While they perform the same function, the latter makes it clear that the
variable does not get reassigned inside the body of the while statement.
The former -- or any version based on `var` -- would not make it so clear.
-- Scott
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
convert a string into a json object, JRough <janis.rough@gmail.com> - 2016-03-31 19:12 -0700
Re: convert a string into a json object, Stefan Weiss <krewecherl@gmail.com> - 2016-04-01 10:42 +0200
Re: convert a string into a json object, JRough <janis.rough@gmail.com> - 2016-04-01 17:32 -0700
Re: convert a string into a json object, Stefan Weiss <krewecherl@gmail.com> - 2016-04-01 10:49 +0200
Re: convert a string into a json object, John Harris <niam@jghnorth.org.uk.invalid> - 2016-04-01 19:21 +0100
Re: convert a string into a json object, Aleksandro <aleksandro@gmx.com> - 2016-04-01 16:21 -0300
Re: convert a string into a json object, Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-04-01 20:36 +0100
Re: convert a string into a json object, Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-04-02 04:07 +0200
Re: convert a string into a json object, Aleksandro <aleksandro@gmx.com> - 2016-04-02 12:07 -0300
Re: convert a string into a json object, Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-04-02 17:36 +0200
Re: convert a string into a json object, Aleksandro <aleksandro@gmx.com> - 2016-04-02 21:01 -0300
Re: convert a string into a json object, Scott Sauyet <scott@sauyet.com> - 2016-04-02 20:40 +0000
Re: convert a string into a json object, Stefan Weiss <krewecherl@gmail.com> - 2016-04-02 01:18 +0200
Re: convert a string into a json object, John Harris <niam@jghnorth.org.uk.invalid> - 2016-04-02 11:29 +0100
Re: convert a string into a json object, Scott Sauyet <scott@sauyet.com> - 2016-04-02 20:30 +0000
Re: convert a string into a json object, JRough <janis.rough@gmail.com> - 2016-04-01 11:32 -0700
Re: convert a string into a json object, Stefan Weiss <krewecherl@gmail.com> - 2016-04-02 00:51 +0200
Re: convert a string into a json object, Aleksandro <aleksandro@gmx.com> - 2016-04-02 12:03 -0300
Re: convert a string into a json object, Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-04-02 03:48 +0200
Re: convert a string into a json object, Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-04-02 04:25 +0200
csiph-web