TypeScript behavior
I'm doing some simple JavaScript coding exercises in TS and have come across this odd behavior I haven't encountered before.
I have only the following code:
I get the following error:
Did a really quick Google search, and it seems to be because it's in the global scope. So I put it in a function and it works.
Now, when I try this code only and by itself:
I get no such error. Why is that?
I have only the following code:
I get the following error:
Did a really quick Google search, and it seems to be because it's in the global scope. So I put it in a function and it works.
Now, when I try this code only and by itself:
I get no such error. Why is that?
