title: How to compare variables to undefined, if I don’t know whether they exist?
body: <p>In JavaScript you can declare a variable and if it’s <code>undefined</code>, you can check <code>variable == undefined</code>; I know that, but how can you compare a value that you don’t know yet if it’s in memory?</p>
  
  <p>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?</p>
  
  <p>Is there a way without using <code>try</code>–<code>catch</code>?</p>