For example,
Math.mymfunc = function (x) {
return x+1;
}
will be treated as a property and when I write
for(var p in Math.__proto__) console.log(p)
it will be shown. But the rest of Math functions will not. How can I get all functions of a Math object?
Object.getOwnPropertyNames(Math);is what you are after.This logs all of the properties provided you are dealing with an EcmaScript 5 compliant browser.