Javascript String toTagPopularitySize()

Description

Javascript String toTagPopularitySize()

// Returns a font size based on value
String.prototype.toTagPopularitySize = function(){

 var val = Number(this);
 var fs = '';

 if(val / 10 < 1){
  fs = val / 10 + 1 + "em";
 } else if (val / 10 > 2){
  fs = "2em";/*www  .  j  av a2 s.c om*/
 } else {
  fs = val / 10 + "em";
 };
 
 return fs;
}



PreviousNext

Related