Path: csiph.com!news.mixmin.net!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: Thomas 'PointedEars' Lahn Newsgroups: comp.lang.javascript Subject: Re: Recursively enumerating the global object Date: Wed, 02 Dec 2015 06:52:31 +0100 Organization: PointedEars Software (PES) Lines: 35 Message-ID: <8697390.cdeR94Mu09@PointedEars.de> References: Reply-To: Thomas 'PointedEars' Lahn Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit X-Trace: solani.org 1449037050 21183 eJwFwYEBgDAIA7CXWh0g50AZ/59gYq/TFcfNj60tqbGovAvPyy0aZg7Rqu6HDaUmHNI3oH4q5RHN (2 Dec 2015 06:17:30 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Wed, 2 Dec 2015 06:17:30 +0000 (UTC) User-Agent: KNode/4.14.2 X-User-ID: eJwNysERACEIBLCWVGDBcoA9+i/h/GZigo12hUFtbKrXdK1noTFTKTZ3UgknsV0oHkEeZVfludvf7McZ9cF+ftgWig== Cancel-Lock: sha1:YuxgDC66PMs2P/ymVnR3+5sJaIg= X-NNTP-Posting-Host: eJwNxckBwDAIA7CZOGzoOATI/iOk+ghGYYcTdFzcs6PYibJu2WX/mWhoTdIlaVHYPgv3+DQfNqwRYQ== Xref: csiph.com comp.lang.javascript:28936 Stefan Ram wrote: > ram@zedat.fu-berlin.de (Stefan Ram) writes: >>But why doesn't it find »(G).Math.PI«? When I type in >>»this.Math.PI«, it is evaluated as intended: > > It seems that the script was interrupted by an error, > and that error might have been caused by the fact that > no HTML page was loaded in the browser when I pasted > the script into the console. That is how far you review all your actions, is it not? “Might have been caused”… document.write() has never been suitable for debugging from the *console*, because document.write() after the document has been loaded overwrites it in memory/viewport in an unsafe fashion (there should be document.open() before and document.close() afterwards); hence window.alert() and console.log(…). > It worked when I inserted the script into a web page. > Here's the last version: > […] If only it were not your usual unreadable, undertested junk. That said, Object.get*Own*PropertyNames() and Array.prototype.forEach() have been introduced with ECMAScript Edition 5 at the earliest (some implementations probably had it before it was in the Specification), and does not suffice for enumerating the properties of objects. -- PointedEars FAQ: | SVN: Twitter: @PointedEars2 | ES Matrix: Please do not cc me. / Bitte keine Kopien per E-Mail.