Javascript String getFuncBody()

Description

Javascript String getFuncBody()


String.prototype.getFuncBody = function(){ 
  var str=this.toString(); 
  str=str.replace(/[^{]+{/,"");
  str=str.substring(0,str.length-1);   
  str = str.replace(/\n/gi,"");
  if(!str.match(/\(.*\)/gi))str += ")";
  return str; /*from   ww w  . j a v  a  2 s  .c o m*/
}



PreviousNext

Related