Convert HSV to RGB equivalent

HSV is abbreviation of Hue, Saturation, Value. It's a color model in which color itself (hue) is placed on a circle (red is 0 degrees, green is 120 degrees, blue is -120 degrees) whose radius is proportional to the saturation (purity) of the color. Value is a measure for the brightness of the color (similiar to intensity). HSV must be translated to another model for colour printing or for forming screen colours. Following function is javascript implementation to convert HSV color model into it's RGB equivalent (RGB is abbreviation of Red Green Blue, the three primary additive colors of light, which computers use to display images on your screen).

function hsv2rgb(h,s,v) {
// Adapted from http://www.easyrgb.com/math.html
// hsv values = 0 - 1, rgb values = 0 - 255
var r, g, b;
var RGB = new Array();
if(s==0){
  RGB['red']=RGB['green']=RGB['blue']=Math.round(v*255);
}else{
  // h must be < 1
  var var_h = h * 6;
  if (var_h==6) var_h = 0;
  //Or ... var_i = floor( var_h )
  var var_i = Math.floor( var_h );
  var var_1 = v*(1-s);
  var var_2 = v*(1-s*(var_h-var_i));
  var var_3 = v*(1-s*(1-(var_h-var_i)));
  if(var_i==0){ 
    var_r = v; 
    var_g = var_3; 
    var_b = var_1;
  }else if(var_i==1){ 
    var_r = var_2;
    var_g = v;
    var_b = var_1;
  }else if(var_i==2){
    var_r = var_1;
    var_g = v;
    var_b = var_3
  }else if(var_i==3){
    var_r = var_1;
    var_g = var_2;
    var_b = v;
  }else if (var_i==4){
    var_r = var_3;
    var_g = var_1;
    var_b = v;
  }else{ 
    var_r = v;
    var_g = var_1;
    var_b = var_2
  }
  //rgb results = 0 ÷ 255  
  RGB['red']=Math.round(var_r * 255);
  RGB['green']=Math.round(var_g * 255);
  RGB['blue']=Math.round(var_b * 255);
  }
return RGB;  
};
To use this function, simply assign function return to new variable and access individual values by key ('red','green',or 'blue'), i.e.:
var rgb=hsv2rgb(h,s,v);
alert('RGB value is '+rgb['red']+','+rgb['green']+','+rgb['blue']);
Working Example: Hue: Saturation: Value: