Equivalent of Python's dir in Javascript

后端 未结 6 1584
孤城傲影
孤城傲影 2020-12-03 04:06

when I write Python code from the interpreter I can type dir() to have a list of names defined in the current scope. How can achieve to have the same informatio

6条回答
  •  日久生厌
    2020-12-03 04:47

    There is "keys" method in Object, for example:

    Object.keys(object)
    

    But this return object's own properties and methods only.
    To list all properties and methods of an object I know 2 possibilities:
    1. console.dir(object) method in firebug console for Firefox and
    2. dir(object) method in Google Chrome development tools.

提交回复
热议问题