Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!us.feeder.erje.net!feeder.erje.net!1.eu.feeder.erje.net!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: Thomas 'PointedEars' Lahn Newsgroups: comp.lang.javascript Subject: Re: Identity of values in Javascript Date: Sat, 23 May 2015 09:35:17 +0200 Organization: PointedEars Software (PES) Lines: 55 Message-ID: <3579463.nIugcK88cu@PointedEars.de> References: <555f256b$0$12988$c3e8da3$5496439d@news.astraweb.com> <87r3q8h3yf.fsf@bsb.me.uk> <555f7d3b$0$13002$c3e8da3$5496439d@news.astraweb.com> <87d21sgpqy.fsf@bsb.me.uk> Reply-To: Thomas 'PointedEars' Lahn Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit X-Trace: solani.org 1432366677 9940 eJwNxskBwCAIBMCWJAuLlsMh/Zdg5jUGCsuVRrWxgfAaPGVO70/jNNK1EVqxG1iXGuQtwb+VDxYxEPo= (23 May 2015 07:37:57 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Sat, 23 May 2015 07:37:57 +0000 (UTC) User-Agent: KNode/4.14.2 X-User-ID: eJwNysEBwCAIA8CVQBKEcQRl/xHaex/N1XvD6eBwEIHaJ3IE05y7baHvUKVekOdKoEWRHpF9Ty5DqTxa/Wk+TCcVPw== Cancel-Lock: sha1:Y6IWbrdM27pZzbU7ldc7BbOoXQg= X-NNTP-Posting-Host: eJwNyMEBwCAIA8CVIhCo4yDI/iPYex7Vl1eY043DKcTH6IO2zM1aKBXX0ENUtu3LUh/IFfQfDxihEUc= Xref: csiph.com comp.lang.javascript:27843 Stefan Ram wrote: > Ben Bacarisse writes: >> There's no real harm in that and Javascript is a rather vague term >> anyway. Most implementations aim to conform with the ECMAScript >> specification and that uses Number etc when talking about the types. > > Some say that »JavaScript« is the name of the ECMAScript > implementation of Netscape/Mozilla, so: This is not only that “some” say, but something that is true. See the ES Matrix and referenced material, in particular my thesis linked there and material referenced in there, for details. > console.log( window.navigator.appCodeName ); > "Mozilla" That does not prove anything. The value of the “appCodeName” property of the “navigator” object is the part of the “navigator.userAgent” value that precedes the *application* version. You get exactly the same value in Chrome/Chromium even though the ECMAScript implementation in Chrome/Chromium is Google V8 JavaScript. Likewise for other HTML user agent environments. The reason for that is that when Microsoft Internet Explorer was published, Netscape Navigator with its Mozilla codebase was already around, and people would check for that. To increase their browser’s market share, Microsoft used much the same User-Agent string; other vendors did too, so it gradually became useless (although nowadays pertinent pieces have been re-added). Which is also why browser sniffing *instead of* feature detection is a bad idea (but there are edge cases where there is no other way, even for experts). See the ES Matrix (see my sig) for an exclusion algorithm that is capable of inferring the used ECMAScript implementation and version in several cases. > console.log( typeof( 2 )); > "number" “typeof” is an operator; you should not write it as if it were a function call: console.log(typeof 2); > However, the MDN sometimes uses upper-case and sometimes > lower-case spellings for those types. Example? -- PointedEars FAQ: | SVN: Twitter: @PointedEars2 | ES Matrix: Please do not cc me. / Bitte keine Kopien per E-Mail.