Easiest way to check if string is null or empty

前端 未结 11 1172
南笙
南笙 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 13:07

    If you need to check that the content is a string, not null and not an array, use a simple typeof comparison:

     if typeof email isnt "string"
    

提交回复
热议问题