Home > Net >  firebase auth.currentUser.email error/bug?
firebase auth.currentUser.email error/bug?

Time:03-09

clearly ([email protected] === "[email protected]" || "[email protected]") should return false

so why is it printing "email in first : [email protected]"

when it should print "email was : [email protected]"

code below

let email = auth.currentUser.email


if(email === "[email protected]" || "[email protected]") {
    alert("email in first : "   auth.currentUser.email )
    checkUserIsNotAlreadyInGame() 
    return
        } else {
            alert("email was :"   auth.currentUser.email )
            return
        }

prints "email in first : [email protected]"

CodePudding user response:

your expression will always evaluate to true because it falls to the "[email protected]" string which always evaluates to true in the condition.

change your condition to the following:

if(email === "[email protected]" || email === "[email protected]")

then you'd get the expected result

  • Related