title: In macOS AppleScript, how do I check if a property exists?
body: <p>In AppleScript I access an object in an application, e.g.:</p>
  
  <pre class="lang-applescript prettyprint-override"><code>tell application id "DNtp"
    repeat with g in (children of root of (think window 1))
         set theAnnotation to annotation of g
    end
  end tell
  </code></pre>
  
  <p>I know that depending on the child accessed, <code>g</code> sometimes has no <code>annotation</code> property. </p>
  
  <p><strong>N.B.</strong> This is <em>not the same</em> as having a <code>missing value</code> or something like that.</p>
  
  <p>When running the code,  AppleScript simply complains that the variable <code>theAnnotation</code> is not defined.</p>
  
  <p>Other than trapping the error with a <code>try ... on error</code> statement, how do I check if <code>g</code> has the property <code>annotation</code>?</p>