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);
}