WHAT "confusing scope" -- it's scoped to the function if any. That's not hard or confusing, and if your function is so complex that's insufficient, it's time to break it into smaller bits.
I dunno, maybe I've been at this too long and spent far too many years working in Wirth family languages like Pascal, Modula 2, and Ada.
... and instanceof works great for inheritance since it's valid for the entire inheritance chain. I want all nodes be they text, comment, or element, "a instance of Node" is true. Meanwhile if I have a textNode and only want elements, "textNode instanceof Element" is false. Exactly what I need in most cases.
So I'm not sure what you're on about there -- though I find with my radically different background in programming from most a lot of what people call "side effects" are exacty what I want, a lot of what people call "easy" I find painfully cryptic and complex, and much of what things like "linters" get their panties in a twist over I call good code... and a LOT of what people call good code and good practices I find to be the exact opposite.