How to get the list of all Math standard built-in object methods (functions) in TypeScript

1 Answer

0 votes
console.log(Object.getOwnPropertyNames(Math).filter(function (p : any) : any {
    return typeof Math[p] === 'function';
}));
 
 
 
/*
run:
 
[
"abs"
"acos"
"asin"
"atan"
"atan2"
"ceil"
"clz32"
"cos"
"exp"
"floor"
"imul"
"fround"
"log"
"max"
"min"
"pow"
"random"
"round"
"sin"
"sqrt"
"tan"
"log10"
"log2"
"log1p"
"expm1"
"cosh"
"sinh"
"tanh"
"acosh"
"asinh"
"atanh"
"hypot"
"trunc"
"sign"
"cbrt"
]
 
*/

 



answered Jun 9, 2022 by avibootz
...