Easiest way to check if string is null or empty

前端 未结 11 1219
南笙
南笙 2021-01-30 12:30

I\'ve got this code that checks for the empty or null string. It\'s working in testing.

eitherStringEmpty= (email, password) ->
  emailEmpty = not email? or          


        
11条回答
  •  借酒劲吻你
    2021-01-30 12:54

    Based on this answer about checking if a variable has a truthy value or not , you just need one line:

    result = !email or !password
    

    & you can try it for yourself on this online Coffeescript console

提交回复
热议问题