18
sarafe
16d

My first login function

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

Comments
  • 6
    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
    Suits best for all gods you know. All of them are one positive entity. They all use same account. (✷‿✷)
  • 6
    I didn’t just read that. I am dead. I’m seeing this because I went to hell.
  • 2
    Good but where's the captcha.
  • 0
    Tbf, I wish more websites would use this
  • 1
    @Wombat my favourite function.!
  • 1
    @kindawonderful lol. Thanks for mentioning me. 😅
Add Comment