How do you know what methods an object has

How do you know what methods an object has, for example XMLHttpRequest?

+3
source share
4 answers

Try

for ( method in yourObject ){
 document.write(method + '<br>');
}

or similar. Some browsers hide object methods ...

+4
source
function getFunctions(obj) {
    var funcs = [];
    for (var i in obj)
        if (typeof(obj[i]) == "function")
            funcs.push(i);
    return funcs;
}
+2
source

You can see the Mozilla Developer Center .

+2
source

1) Language documentation

2) Google

3) Autocomplete IDE

0
source

Source: https://habr.com/ru/post/1773785/


All Articles