16
sarafe
4y

My first login function

const login = (email, password) => {
If (email && password) {
return true
} else {
return false
}
}

Comments
  • 5
    Well it's not _wrong_, you need an email and a password... 🤷‍♂️
  • 3
    Hm, what does it do. Are e-mail and password booleans or is just any non empty combination of the two considered valid?

    Damn, javascript and auto conversion
  • 1
    @nitwhiz yeah, this working fine..
  • 1
    @p100sch not empty variable valid except 0 (zero)
  • 7
    Return (email && password)
  • 2
    On a side note, you can often do away with the 'else' clause. I find it cleaner to write:

    if (...) {
    return a;
    }
    return b;
  • 0
    @Okii yeah, but you know lah, I don't even think about clean at first time, I just want to work and running. ;)
  • 1
    Good but where's the captcha.
  • 0
    Tbf, I wish more websites would use this
  • 0
    @kindawonderful lol. Thanks for mentioning me. 😅
Add Comment