moussa-e
9/29/2016 - 9:08 AM

GlobalJavascript #Javascript #MoussaElAnnan #Jquery

GlobalJavascript #Javascript #MoussaElAnnan #Jquery

/*
* Function that removes Null or Undefined properties form object.
* @param {obj} The object.
*/
removeNullPropertiesFromObject = function (obj) {
            for (var propName in obj) {
                if (obj.hasOwnProperty(propName)) {
                    if (obj[propName] === null || obj[propName] === undefined) {
                        delete obj[propName];
                    }
                }
            }
            return obj;
        }
function capitalizeFirstLetter(string) {
    return string.charAt(0).toUpperCase() + string.slice(1);
}