lundi 15 juin 2020

why is this coming back true and not false?

For the life of me I have no idea why this code is coming back true when the variables I am using are not the same.

 deleteComment(comment){
      console.log(this.user.id)
      console.log(this.$route.params.id) 
        if('this.user.id', '==', 'this.$route.params.id'){
              db.collection("comments").doc(comment.id).delete();
              console.log("Document successfully deleted!")
            } else {
              console.log('no can do')
            }
         }
       }
   }

say this.user.id = a and this.$route.params.id = b.

I run this code console.log has the values correct with each log. But then this still deletes the doc, when it should not.

From my understanding if(a == b) is not true then it should drop down to the else portion of code? Using Vue

Aucun commentaire:

Enregistrer un commentaire