This is part 2 of the tutorial series Learn Javascript in Construct . This picks up from where part 1 left off. So in case you missed it, see Learn Javascript i...
To be more specific, the console returns:
"Uncaught ReferenceError: b is not defined
at <anonymous>:1:1"
That's normal - the console basically works in global scope, and it can't access variables declared in other functions (and script blocks in event sheets are actually inside functions), just like how you can't write code in one function that accesses a local variable inside a different function.