Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

String.prototype

9 views
Skip to first unread message

Jan Honza Odvarko

unread,
Jul 7, 2011, 8:23:27 AM7/7/11
to
Is there any way how a developer tool (e.g. Firebug) could display
list of built in methods in String.prototype?

These properties are not enumerable and so can't be listed using
for ... in.

But perhaps somebody knows about another way...?

Honza

Boris Zbarsky

unread,
Jul 7, 2011, 10:05:04 AM7/7/11
to

Object.getOwnPropertyNames(String.prototype)

-Boris

johnjbarton

unread,
Jul 7, 2011, 10:33:48 AM7/7/11
to

However beware, for...in does two things: enumerates and climbs up
prototype chain. getOwnPropertyNames lists all properties, but does not
climb the chain.

For JS code using objects as tables, I think Object.keys() is the right
choice: enumerable, no climb.

As far as I can find out, the missing function is getAllPropertyNames:
all properties and climbs.

(see getObjectProperties() in Firebug's domPanel.js).

jjb

Jan Honza Odvarko

unread,
Jul 7, 2011, 10:16:09 AM7/7/11
to

Ah, true, thanks!
Honza

0 new messages