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


Groups > comp.lang.javascript > #23065

Re: Trying to view the properties of an object

Message-ID <12217692.SD4hFpOu69@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Organization PointedEars Software (PES)
Date 2014-02-11 14:03 +0100
Subject Re: Trying to view the properties of an object
Newsgroups comp.lang.javascript
References <properties-20140211082627@ram.dialup.fu-berlin.de> <prototypes-20140211091448@ram.dialup.fu-berlin.de>

Show all headers | View raw


Stefan Ram wrote:

> ram@zedat.fu-berlin.de (Stefan Ram) writes:
>>. What I actually wanted to see was a list of all the
>>well-known object prototype properties (functions) such as
> 
>   In the meantime, I found out that what I was looking for is:
> 
> console.log( Object.getOwnPropertyNames( 0 . __proto__ . __proto__ ));
> 
>   .

The same could have been achieved with

  Object.getOwnPropertyNames(Object.prototype)

Because we know that “0” is a primitive Number value, which is converted to 
a Number instance for the purpose of property access (“.”).  The “__proto__” 
property is a proprietary property whose value is the prototype of the base 
object (the value of its internal [[Prototype]] property).  The prototype of 
a Number instance is the Number prototype, and its prototype is the Object 
prototype which by default is referred by the value of Object.prototype.  
console.log() is superfluous because it does not add more information in 
this case.

It should also be noted that “0.__proto__” is a syntax error, while
“0 .__proto__” and ”0..__proto__” are not, because the first and second one 
cannot, and the third one can be produced by the /DecimalLiteral/ 
production.  Another possibility is the grouping operator: (0).__proto__

-- 
PointedEars

Twitter: @PointedEars2
Please do not Cc: me. / Bitte keine Kopien per E-Mail.

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


Thread

Re: Trying to view the properties of an object Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-02-11 14:03 +0100

csiph-web