views:

43

answers:

2

Is there any way to determine how many or what functions are defined at certain scope?, let's say the global scope...

I don't think so, but I give it a try here

EDIT: looping through window properties does not work in IE for this purpose. Is it doable in IE?

+1  A: 

Look through the window object:

for (var p in window)
{
  console.log(window[p]);
}

Any function you create becomes method of the window object, so you need to inspect that to see what is in the global scope.

Sarfraz
Just note that in all IE versions, identifiers defined with a Function Declaration or a Variable Declaration on the Global Execution Context, will not be enumerated in the `for-in` loop. This is a well known bug and hasn't been fixed even on IE9pre3. Check this [example](http://jsbin.com/aboge4/2/edit).
CMS
@CMS: That very bad then, hope there is a workaround for that. Thanks
Sarfraz
@sAc I already tried that whithout any success, I forgot to mention that I was testing in IE. Thanks Anyway
Matias
+1  A: 

Try to inspect a window object, which represent global scope. Use for example for (var in obj) {}

srigi