Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #33448
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: x === x |
| Date | 2017-05-31 12:39 +0200 |
| Organization | PointedEars Software (PES) |
| Message-ID | <19437984.EfDdHjke4D@PointedEars.de> (permalink) |
| References | <JavaScript-20170530123255@ram.dialup.fu-berlin.de> <874lw231ui.fsf@bsb.me.uk> <context-20170530144535@ram.dialup.fu-berlin.de> <2872662.aeNJFYEL58@PointedEars.de> <87inkh28sf.fsf@bsb.me.uk> |
Ben Bacarisse wrote:
> Thomas 'PointedEars' Lahn <PointedEars@web.de> writes:
>> Stefan Ram wrote:
>>> Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
>>>> What's wrong with {} === {}?
>>> It depends on the context.
>> No, it does not. “===” *makes* the (expression) context.
>
> $ nodejs -c -e '[] === [];' && echo "ok"
> ok
> $ nodejs -c -e '{} === {};' && echo "ok"
> [eval]:1
> {} === {};
> ^^^
>
> SyntaxError: Unexpected token ===
> <snip trace-back>
> $ nodejs -c -e '({} === {});' && echo "ok" ✘
> ok
Fascinating. I had tried in the Chrome DevTools Console, and there the
trailing semicolon makes the difference:
| > {} === {}
| <- false
| {} === {};
| (x) Uncaught SyntaxError: Unexpected token ===
I assume that the explicit semicolon there is considered an /EmptyStatement/
that switches back to statement context.
--
PointedEars
FAQ: <http://PointedEars.de/faq> | <http://PointedEars.de/es-matrix>
<https://github.com/PointedEars> | <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | 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
Re: x === x Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-05-30 14:34 +0100
Re: x === x Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-05-30 15:02 +0100
Re: x === x Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-05-30 16:22 +0200
Re: x === x Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-05-31 01:02 +0100
Re: x === x Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-05-31 12:39 +0200
Re: x === x Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-05-31 21:52 +0100
Re: x === x Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-05-31 23:39 +0200
Re: x === x Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-06-01 01:46 +0100
Re: x === x Julio Di Egidio <julio@diegidio.name> - 2017-06-01 00:14 -0700
Re: x === x John G Harris <niam@jghnorth.org.uk.invalid> - 2017-06-01 10:39 +0100
Re: x === x Julio Di Egidio <julio@diegidio.name> - 2017-06-01 03:37 -0700
Re: x === x John G Harris <niam@jghnorth.org.uk.invalid> - 2017-06-01 18:54 +0100
Re: x === x Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-06-01 21:54 +0100
Re: x === x John G Harris <niam@jghnorth.org.uk.invalid> - 2017-06-02 11:06 +0100
Re: x === x John G Harris <niam@jghnorth.org.uk.invalid> - 2017-06-02 11:08 +0100
Re: x === x John G Harris <niam@jghnorth.org.uk.invalid> - 2017-06-02 10:56 +0100
Re: x === x Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-06-04 12:50 +0100
Re: x === x John G Harris <niam@jghnorth.org.uk.invalid> - 2017-06-04 14:30 +0100
Re: x === x Dr J R Stockton <J.R.Stockton@physics.org> - 2017-06-04 09:03 -0700
Re: x === x Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-06-01 14:45 +0100
Re: x === x Julio Di Egidio <julio@diegidio.name> - 2017-06-01 07:00 -0700
Re: x === x Julio Di Egidio <julio@diegidio.name> - 2017-06-01 00:00 -0700
csiph-web