Path: csiph.com!weretis.net!feeder4.news.weretis.net!news.mb-net.net!open-news-network.org!.POSTED!not-for-mail From: Thomas 'PointedEars' Lahn Newsgroups: comp.lang.javascript Subject: Re: x === x Date: Wed, 31 May 2017 12:39:50 +0200 Organization: PointedEars Software (PES) Lines: 37 Message-ID: <19437984.EfDdHjke4D@PointedEars.de> References: <874lw231ui.fsf@bsb.me.uk> <2872662.aeNJFYEL58@PointedEars.de> <87inkh28sf.fsf@bsb.me.uk> Reply-To: Thomas 'PointedEars' Lahn NNTP-Posting-Host: 47.229.197.178.dynamic.wless.zhbmb00p-cgnat.res.cust.swisscom.ch Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit X-Trace: gwaiyur.mb-net.net 1496227191 28845 178.197.229.47 (31 May 2017 10:39:51 GMT) X-Complaints-To: abuse@open-news-network.org NNTP-Posting-Date: Wed, 31 May 2017 10:39:51 +0000 (UTC) User-Agent: KNode/4.14.2 X-Face: %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&. Thomas 'PointedEars' Lahn writes: >> Stefan Ram wrote: >>> Ben Bacarisse 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 === > > $ 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: | | Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.