p is all the properties, does that include methods ?
or, as in ruby (somehow) a method could be a property of the object ?
For the answer you could try this on say window object ;-)
Yes, "property" term here includes fields, properties (aka compound
properties with getter/setter) and methods. So this term is not an
exact equivalent of similar term used in some programming languages.
Think of it as "anything enumerable this object has".
You can write a full-scaled object walker with additional sortouts of
any complexity.
var props = new Array();
var desc = '';
for (var p in myObject) {
desc = myObject[p] + ' = ' + p + '\n';
desc+= myObject.hasOwnProperty(p) ?
'own ' : 'inherited ';
// methods reported as objects by IE and as functions by others:
desc+= ((typeof p == 'function') || (typeof p == 'object)) ?
'method\n\n' : 'property\n\n';
props.push(myObject[p] + ' = ' + p + '\n');
}
props.sort();
and further...