In JavaScript you can declare a variable and if it’s undefined
, you can check variable == undefined
; I know that, but how can you compare a value that you don’t know yet if it’s in memory?
For example, I have a class which is created when the user clicks a button. Before this, the class is undefined — it doesn’t exist anywhere; how can I compare it?
Is there a way without using try
–catch
?