I'm learning Node.js, and there is something I cannot understand.
I have a function and a Immediately Executing Function, like this:
(
function foo(){
console.log('foo was executed')
}
)()
function foofun(){
return 123
}
console.log(foofun())
When the IEF is at the beginning, the code executes right, but when the foofun() and it's console.log are at the beginning, this gave me this error:
Does it matters the position where is located the IEF? Why this happens?