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


Groups > comp.lang.javascript > #23065 > unrolled thread

Re: Trying to view the properties of an object

Started byThomas 'PointedEars' Lahn <PointedEars@web.de>
First post2014-02-11 14:03 +0100
Last post2014-02-11 14:03 +0100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.javascript

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#23065 — Re: Trying to view the properties of an object

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2014-02-11 14:03 +0100
SubjectRe: Trying to view the properties of an object
Message-ID<12217692.SD4hFpOu69@PointedEars.de>
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.

[toc] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web