Is there a string.Empty
in JavaScript, or is it just a case of checking for ""
?
JavaScript String – How to Check for Empty, Undefined, or Null
is-emptyjavascriptnull
is-emptyjavascriptnull
Is there a string.Empty
in JavaScript, or is it just a case of checking for ""
?
Best Answer
Empty string, undefined, null, ...
To check for a truthy value:
To check for a falsy value:
Empty string (only!)
To check for exactly an empty string, compare for strict equality against
""
using the===
operator:To check for not an empty string strictly, use the
!==
operator: