Showing posts with label validation. Show all posts
Showing posts with label validation. Show all posts

Monday, 11 November 2013

Check Validations of Javascript Variables

        While working with my last project I observed that at every place when I need to validate Javascript variable I need to check two or more conditions. So I write one function which will check whether particular object or variable is valid or not for you. I hope this will helpful to you.


function isValid(obj)
{
        if(typeof obj === "undefined" || obj === null || obj === "" || obj === "null" || obj === "{}"){
              return false;
         }
        return true;
}