admin管理员组文章数量:1240593
Is there a way in js to list all the builtin functions and some info on their parameterlists? I couldn't really find anything about reflection to do this sort of thing
edit: The functions such as Math.sin are actually the ones I want to list, actually all built-in functions.
Is there a way in js to list all the builtin functions and some info on their parameterlists? I couldn't really find anything about reflection to do this sort of thing
edit: The functions such as Math.sin are actually the ones I want to list, actually all built-in functions.
Share Improve this question edited Jan 1, 2012 at 16:40 Ferdy asked Jan 1, 2012 at 15:54 FerdyFerdy 5072 gold badges4 silver badges13 bronze badges 6- 4 What is the point of doing this? How would you use the list? – Pointy Commented Jan 1, 2012 at 15:57
- Why / Where you want this ? Please explain something more – user319198 Commented Jan 1, 2012 at 15:59
- What do you mean by built-in functions? Functions defined in the specification for the global object? Methods of built-in objects (defined by the specification)? Functions of host objects mon to browsers? Functions of the DOM? – Felix Kling Commented Jan 1, 2012 at 16:00
- Built-in where? In the browsers? In the language? – Šime Vidas Commented Jan 1, 2012 at 16:00
- Just open the browsers inspector tool and start browsing the hierarchy of objects/methods – Alex Commented Jan 1, 2012 at 16:11
3 Answers
Reset to default 10Something like this, maybe?
for( var x in window) {
if( window[x] instanceof Function) console.log(x);
}
This will list all native functions in the console (excluding one in native objects, such as Math.sin()
).
Just do console.log(window). Now open your browser and go to console. You will find all the built-in functions of the Javascript like Math.sin and XMLHttpReuest. It will show the plete information about arguments, length, caller and everything about that function.
Another good way to list all functions (and objects) is:
console.log(globalThis)
globalThis
unites window
, self
and frames
objects.
本文标签: List all builtin functions in javascriptStack Overflow
版权声明:本文标题:List all built-in functions in javascript? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1739987083a2218249.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论