So, I think the behavior of the FF environment is fine. A quick look at the specification (6.2.3.1, etc.) Indicates that the code should be executed line by line, up to the second console.log(m) , into which a ReferenceError .
I suspect that it only “looks funny” because of the order in which the console chooses to render the first console.log and exception messages (for example, this is the opposite of Chrome).
Whether the order to process the console is an error or not, I leave it to others.
The following confirmation of my analysis appears, showing a warning before the exception is logged.
if(true) { let m = "yo"; alert(m); } console.log(m)
source share