I have the following code inserted into a html file:
In the above code the with
console.log(myVar)
is rendered first and the system looks for the myVar
variable in the global and local scope. Since, the variable is not found till this point it raises, Uncaught ReferenceError: myVar is not defined
error as var myVar = 1;
is rendered in the next block.
But when you change the order of the blocks to something like below then it will work