Javascript String capitalize(all)

Description

Javascript String capitalize(all)


String.prototype.capitalize = function(all){
 if(all){ /*  w ww.ja v  a2 s .c  o  m*/
  return this.split(' ').map(function(e){return e.capitalize();}).join(' '); 
 }else{ 
  return this.charAt(0).toUpperCase() + this.slice(1);
   } 
  }; "bahay kubo kahit munti".capitalize(true);



PreviousNext

Related