How do you check for an empty string in JavaScript?

I saw this thread, but I didn't see a JavaScript specific example. Is there a simple string.Empty available in JavaScript, or is it just a case of checking for ?

Text Copied From stackoverflow.com
on : Tue, Sep 30, 2008 Views : 1895607

Accepted Answer

If you just want to check whether there's any value, you can do

if (strValue) 
{

  
//do something 

If you need to check specifically for an empty string over null, I would think checking against is your best bet, using the === operator (so that you know that it is, in fact, a string you're comparing against).

Text Copied From stackoverflow.com
on : Tue, Sep 30, 2008

Ask Question

If you want to ask question you must LogIn or SignUp
Login SignUp

Quick Links

E-Magazines

@

Total Followers
Study Group Created
Study Group Joined
Following Teacher
Following Organization
Blog Articles Added
Questions Asked
Questions Answered
Jobs Posted
Total Members in Group
Questions asked by members
Tasks added in this Group

Please wait..

Ok

Login to Open ESchool OR Create your account    Login   SignUp