title: Why am I getting the error "Identifier ... has already been declared"?
body: <p>I am having an issue calling a function which returns an object. The function looks like this.</p>
  
  <pre><code>function upsertDoc(bucketName,docID,doc){
          let bucket = bucketWithName(bucketName)
          return new Promise((resolve,reject)=&gt;{
              bucket.upsert(docID,doc,(err, result2)=&gt;{
              if(err) return reject(err);
              return resolve({docID, result});
              });
          });
          }
  </code></pre>
  
  <p>it it works fine if i call it like this</p>
  
  <pre><code>let { docID, result } = await couch.upsertDoc('contacts',id, myLookup)
  </code></pre>
  
  <p>the problem i have is that if i call prior to this call </p>
  
  <pre><code>let { docID , result} = await couch.getDoc('contacts',id)
  </code></pre>
  
  <p>the system complains <strong>"SyntaxError: Identifier 'result' has already been declared
  "</strong><br>
  So the question is how can i reassign docID and result to my function as </p>
  
  <pre><code>{ docID, result } = await couch.upsertDoc('contacts',id, myLookup)
  </code></pre>
  
  <p>does not work</p>