- 1
function a() {
console.log("1")
}
a()
(function () {
console.log("2")
})();
after running
- 2
a()
function a() {
console.log("1")
}
(function () {
console.log("2")
})();
if you do this, you won"t get an error, but of course you won"t get an error if you delete the function that executes immediately.
what is the reason for this?