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?
question from:
https://stackoverflow.com/questions/65888428/position-of-a-immediately-executing-function 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…