Javascript Number shiftRange(a,b,c,d)

Description

Javascript Number shiftRange(a,b,c,d)

Number.prototype.shiftRange = function(a,b,c,d){
 
 var or = (b - a);
 var nr, v;/* w  ww  . j  a  v  a 2  s.  com*/
 if (or == 0){
  nr = c;
 }else{
  nr = (d - c);  
 } 
 v = (((this - a) * nr) / or) + c;
 
 return v;
}



PreviousNext

Related