I been trying to understand this behavior of functions, but I couldn't find the answer.
I was trying to invoke each function of an array of functions. Everything worked fine, but when I put 'prompt' in the array, I got an error:
Uncaught TypeError: Illegal invocation.
To reproduce the error you can try:
[prompt][0]()
This code will work, I can't explain why neither:
[function() { return prompt }][0]()()
I know there are a few ways around this to make it work, but I want to understand what's is going on.
Thanks a lot!