I see - but this is different. You're trying to access a non-existent property on a global object. That's of course not throwing a "Reference not defined" error, that's true.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I guess
typeof
has some builtin error handling. TIL.Edit: Interestingly, your suggestion works if the variable is in the “temporal dead zone”
Edit 2: Buuuuut, the above doesn’t work with block scoped variables!!
I was too quick - what I meant was:
In other words - it works when qualified (if not in browser global scope, replace "window" with whatever xyz belongs to).
I have done this countless times and never thought to use typeof - which is why I felt the need to comment :-)
I see - but this is different. You're trying to access a non-existent property on a global object. That's of course not throwing a "Reference not defined" error, that's true.