You have a typo where the second instance of let belief = null; should presumably be let belief = undefined;.
I somehow lost sight of the fact that undeclared variables aren’t seen as undefined. I’ll try to update the post.
(Also, I think “It’d print an error saying that foobar is not defined” is false? Confirmed by going to the browser console and running that two-liner; it just prints undefined to the console.)
Hm. I get Uncaught ReferenceError: foobar is not defined.
I somehow lost sight of the fact that undeclared variables aren’t seen as
undefined
. I’ll try to update the post.Hm. I get
Uncaught ReferenceError: foobar is not defined
.Thanks!