2

I have an Javascript Object and I want to give out all Properties of this Object.

Currently I´m having this Piece of Code, which gives me the Name of all Properties. But if it´s a Function I also need all Parameters the Function would accept.

for(var property in Object) {
    console.log(property);
}

Output
...
...
...
TD
explicitJoin
hashCode
getED
queryConditions
getDisplayTagName
getClass
displayValue
addCondition
getEncodedString
getDisplayValue
addOrCondition
multiple
...
...
...
makim
  • 3,154
  • 4
  • 30
  • 49
  • You're looking for https://developer.mozilla.org/en-US/docs/Enumerability_and_ownership_of_properties – SLaks Jun 25 '13 at 13:26
  • Strange mess of OOP terms... – VisioN Jun 25 '13 at 13:26
  • 2
    What exactly do you mean by "interface"? Please explain exactly what you want. Do you want the list of formal parameters the function accepts? – apsillers Jun 25 '13 at 13:26
  • In OOP, an Interface is usually a class-like construct that specifies methods and attributes that an object that implements it must have. It is used as a half-way step to multiple inheritance that avoids the problems caused by multiple inheritance. **JavaScript has nothing like it** so it makes no sense to ask what interface an object has. – Quentin Jun 25 '13 at 13:30
  • By interface I mean the parameters the function accepts! Updated the Question... – makim Jun 25 '13 at 13:30

1 Answers1

1

By using

 for(var property in Object) {
    console.log(property);
}

you will get key of each element, If that property is a function and you want to use values than use

Object[property]
Anshul
  • 9,312
  • 11
  • 57
  • 74