Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List all built-in functions in javascript?

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.

like image 613
Ferdy Avatar asked Jan 01 '12 15:01

Ferdy


People also ask

How many functions are there in JavaScript?

There are 3 ways of writing a function in JavaScript: Function Declaration. Function Expression. Arrow Function.

What are built in functions?

Built-in functions are ones for which the compiler generates inline code at compile time. Every call to a built-in function eliminates a runtime call to the function having the same name in the dynamic library.

What are functions () in JavaScript?

A function in JavaScript is similar to a procedure—a set of statements that performs a task or calculates a value, but for a procedure to qualify as a function, it should take some input and return an output where there is some obvious relationship between the input and the output.


1 Answers

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()).

like image 86
Niet the Dark Absol Avatar answered Oct 28 '22 12:10

Niet the Dark Absol