最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Show all object methods in a list in Chrome console? - Stack Overflow

programmeradmin2浏览0评论

I really love the Chrome console because it autocompletes all the object methods for me.

But it only shows one at a time and I have to press TAB to step to the next one.

Is there a way to show a list of all the autocompletion object methods?

I really love the Chrome console because it autocompletes all the object methods for me.

But it only shows one at a time and I have to press TAB to step to the next one.

Is there a way to show a list of all the autocompletion object methods?

Share Improve this question asked Oct 1, 2010 at 22:07 never_had_a_namenever_had_a_name 93.2k105 gold badges277 silver badges392 bronze badges 1
  • Related: View list of all JavaScript variables in Google Chrome Console – Marcel Korpel Commented Oct 1, 2010 at 22:24
Add a comment  | 

5 Answers 5

Reset to default 11
console.dir( someObject );

You could loop though and print them. Here's an example for window:

for(var i in window) if(window.hasOwnProperty(i)) console.log(i);

I noticed in recent versions (10+) of Chrome, you can just type the object name and it will build you a tree of the object:

someObject;

you can also use console.log(someObject);

Ben McCormack's way works as well, you just need to be Paused on breakpoint (in Chrome DevTools > Sources )

Use Object.getPrototypeOf

Object.getPrototypeOf(objectHere)
// or
console.dir(Object.getPrototypeOf(objectHere))
发布评论

评论列表(0)

  1. 暂无评论