Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #28936

Re: Recursively enumerating the global object

From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups comp.lang.javascript
Subject Re: Recursively enumerating the global object
Date 2015-12-02 06:52 +0100
Organization PointedEars Software (PES)
Message-ID <8697390.cdeR94Mu09@PointedEars.de> (permalink)
References <global-20151202015022@ram.dialup.fu-berlin.de> <global-dump-20151202024621@ram.dialup.fu-berlin.de>

Show all headers | View raw


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: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix>
Please do not cc me. / Bitte keine Kopien per E-Mail.

Back to comp.lang.javascript | Previous | Next | Find similar | Unroll thread


Thread

Re: Recursively enumerating the global object Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-12-02 06:52 +0100

csiph-web