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
 |  Show 1 more ment

3 Answers 3

Reset to default 10

Something 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