title: How do i have a statement executed if .then fails
body: <pre><code>   firestore.collection("Something").where("User2", "==", "")
      .get()
      .then(function(querySnapshot) {    
          querySnapshot.forEach(function(doc) {
              const docRef = firestore.collection("Something").doc(doc.id); 
              docRef.update({
  
                  User2: messageseqno,
          })
      })
      .catch(error =&gt; {
      console.log(error);
          const docRef = firestore.collection("Something").doc(); 
            var nullvalue = "";
  
            docRef.update({
  
                User1: messageseqno,
                User2: nullvalue,
  
            })
      });
      })
  </code></pre>
  
  <p>I need this to execute like if-else statements. considering .then is if , what can i do to get else.</p>
  
  <p>The above code shows me an error </p>
  
  <blockquote>
    <p>"Cannot read property 'catch' of undefined"</p>
  </blockquote>