Javascript syntax--what am I doing wrong?
<p>I am new to javascript. I have two documents--an old and a new--that I am comparing. However, I am getting a syntax error somewhere in the code below.<br>
Somewhere in here, my code is blowing up. The error says "expression does not eval to a function." Any syntactic ideas of where I'm writing an incorrect statement?  </p>

<pre><code>if(userCtx.name != oldDoc.Document.attributeA) { 
        for (var key in oldDoc.Document)
        {
          if(newdoc.Document.hasOwnProperty('key')
          {
            if(oldDoc.Document[key] != newDoc.Document[key])
            {
               if(key === 'attributeB')
               {
                 return;
               }
               else
               {
                 throw(forbidden: 'Only admins may change this field.')
               }
            }
          }
        }
    } 
</code></pre>
