Discover javascript methods via javascript

This is a strange little method that I found recently (and am sorry that I can’t link where I found it, as I lost the link). I was using some really old code, something like 7 year old code from a CMS I had the “pleasure” of working with. And we used the Telerik widgets at the time. Now since jQuery came out we quickly dropped them because they were far from lightweight.

But that was a long time ago. And I had to make an update to the site just recently. Problem was Telerik in their wisest of wise days have removed all the documentation for this version of their code. Uch! And I wanted to do something that I knew was possible, but all their current documentation only relates to the current libraries and there has been massive changes – well you can’t fault them for that, their stuff gets better all the time.

So what was I to do!! That’s where this comes in:

    var methods = [];
    for (var m in tab) {
        if (typeof tab[m] == "function") {

And this gave me the names of all the functions that were available on the object I was looking at. Now this doesn’t give parameters but it was enough that I could take it forward and get what I needed working.

Hope it can help you at some point.

Leave a Reply

Your email address will not be published.